|
|
package com.teamcenter.rac.workflow.commands.newprocess;
|
|
|
|
|
|
import com.teamcenter.rac.aif.AbstractAIFOperation;
|
|
|
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
|
|
|
import com.teamcenter.rac.common.TCConstants;
|
|
|
import com.teamcenter.rac.kernel.ResourceMember;
|
|
|
import com.teamcenter.rac.kernel.TCAttachmentScope;
|
|
|
import com.teamcenter.rac.kernel.TCComponent;
|
|
|
import com.teamcenter.rac.kernel.TCComponentGroup;
|
|
|
import com.teamcenter.rac.kernel.TCComponentTask;
|
|
|
import com.teamcenter.rac.kernel.TCComponentTaskTemplate;
|
|
|
import com.teamcenter.rac.kernel.TCComponentTaskTemplateType;
|
|
|
import com.teamcenter.rac.kernel.TCComponentType;
|
|
|
import com.teamcenter.rac.kernel.TCComponentUser;
|
|
|
import com.teamcenter.rac.kernel.TCException;
|
|
|
import com.teamcenter.rac.kernel.TCPreferenceService;
|
|
|
import com.teamcenter.rac.kernel.TCSession;
|
|
|
import com.teamcenter.rac.util.Cookie;
|
|
|
import com.teamcenter.rac.util.FilterDocument;
|
|
|
import com.teamcenter.rac.util.HorizontalLayout;
|
|
|
import com.teamcenter.rac.util.MessageBox;
|
|
|
import com.teamcenter.rac.util.PropertyLayout;
|
|
|
import com.teamcenter.rac.util.Registry;
|
|
|
import com.teamcenter.rac.util.Separator;
|
|
|
import com.teamcenter.rac.util.UIUtilities;
|
|
|
import com.teamcenter.rac.util.VerticalLayout;
|
|
|
import com.teamcenter.rac.util.combobox.iComboBox;
|
|
|
import com.teamcenter.rac.util.iTextArea;
|
|
|
import com.teamcenter.rac.util.iTextField;
|
|
|
import com.teamcenter.rac.util.log.Debug;
|
|
|
import com.teamcenter.rac.workflow.commands.assignmentlist.AssignAllTasksPanel;
|
|
|
import com.teamcenter.rac.workflow.common.taskproperties.TaskAttachmentsPanel;
|
|
|
import com.teamcenter.rac.workflow.processdesigner.ProcessDesignerApplicationPanel;
|
|
|
import com.teamcenter.rac.workflow.processdesigner.plugin.Activator;
|
|
|
import java.awt.Dimension;
|
|
|
import java.awt.event.ActionEvent;
|
|
|
import java.awt.event.ActionListener;
|
|
|
import java.awt.event.ItemEvent;
|
|
|
import java.awt.event.ItemListener;
|
|
|
import java.awt.event.KeyEvent;
|
|
|
import java.awt.event.KeyListener;
|
|
|
import java.beans.PropertyChangeEvent;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.Vector;
|
|
|
import javax.swing.ButtonGroup;
|
|
|
import javax.swing.ImageIcon;
|
|
|
import javax.swing.JCheckBox;
|
|
|
import javax.swing.JLabel;
|
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JRadioButton;
|
|
|
import javax.swing.JScrollPane;
|
|
|
import javax.swing.JTabbedPane;
|
|
|
import javax.swing.SwingUtilities;
|
|
|
import javax.swing.border.EtchedBorder;
|
|
|
import javax.swing.event.ChangeEvent;
|
|
|
import javax.swing.event.ChangeListener;
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
public class NewProcessDialog extends AbstractProcessDialog {
|
|
|
private static final Logger logger = Logger.getLogger(NewProcessDialog.class);
|
|
|
|
|
|
public JPanel templatePanel;
|
|
|
|
|
|
public JPanel inputPanel;
|
|
|
|
|
|
public JLabel processFilterLabel;
|
|
|
|
|
|
public JLabel processNameLabel;
|
|
|
|
|
|
public JLabel processDescLabel;
|
|
|
|
|
|
public JLabel processDefinitionLabel;
|
|
|
|
|
|
public iTextField processNameTextField;
|
|
|
|
|
|
public iTextArea processDescTextArea;
|
|
|
|
|
|
public JScrollPane processDescScrollPane;
|
|
|
|
|
|
public iComboBox processDefinitionComboBox;
|
|
|
|
|
|
public ButtonGroup filterRadioButtonGroup;
|
|
|
|
|
|
public JRadioButton allRadioButton;
|
|
|
|
|
|
public JRadioButton assignedRadioButton;
|
|
|
|
|
|
public JCheckBox switchOffUCCheckBox;
|
|
|
|
|
|
public boolean currentSelection = true;
|
|
|
|
|
|
public boolean switchOffUCTemplates = false;
|
|
|
|
|
|
public boolean onlyAssigned = false;
|
|
|
|
|
|
public JTabbedPane tabPanel;
|
|
|
|
|
|
public TaskAttachmentsPanel attachmentsPanel;
|
|
|
|
|
|
TCComponent[] attachments = null;
|
|
|
|
|
|
public ProcessDesignerApplicationPanel processDesignerPanel;
|
|
|
|
|
|
public ImageIcon attachmentTabIcon;
|
|
|
|
|
|
public ImageIcon processDesignerTabIcon;
|
|
|
|
|
|
public Vector procListAll = new Vector();
|
|
|
|
|
|
public Vector procList = new Vector();
|
|
|
|
|
|
public Vector procListAssigned = new Vector();
|
|
|
|
|
|
public NewProcessOperation newProcessOp;
|
|
|
|
|
|
public LoadProcDefsOperation loadOp;
|
|
|
|
|
|
protected AssignAllTasksPanel assignPanel = null;
|
|
|
|
|
|
public int radioButtonFlag = 1;
|
|
|
|
|
|
public int curSelTemplateIndex = -1;
|
|
|
|
|
|
public TCSession session = null;
|
|
|
|
|
|
protected ResourceMember[] selResourceList = null;
|
|
|
|
|
|
public InterfaceAIFComponent[] pasteTargets = null;
|
|
|
|
|
|
public ITemplateFilter filterInstancer = null;
|
|
|
|
|
|
static final int ALL = 1;
|
|
|
|
|
|
static final int NONE = 2;
|
|
|
|
|
|
static final int ASSIGNED = 3;
|
|
|
|
|
|
static final String UC_COOKIE = "undConstructTemplates";
|
|
|
|
|
|
Cookie m_ckUndConstruct = Cookie.getCookie("undConstructTemplates");
|
|
|
|
|
|
public JCheckBox inheritTargetsCheckBox;
|
|
|
|
|
|
TCComponent creatorTask = null;
|
|
|
|
|
|
TCComponent[] creatorTaskTargets = null;
|
|
|
|
|
|
boolean inheritTargetsEnabled = false;
|
|
|
|
|
|
boolean inheritTargetsSelected = false;
|
|
|
|
|
|
private String m_value_CR_allow_alternate_procedures = null;
|
|
|
|
|
|
private void setUndConstructCookieValue(boolean paramBoolean) {
|
|
|
try {
|
|
|
byte b = (byte) (paramBoolean ? 1 : 0);
|
|
|
this.m_ckUndConstruct.setString("undConstructTemplates", b);
|
|
|
this.m_ckUndConstruct.close();
|
|
|
} catch (Exception exception) {
|
|
|
logger.warn("Error while setting value for cookie undConstructTemplates", exception);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private boolean getUndConstructCookieValue() {
|
|
|
boolean bool = false;
|
|
|
try {
|
|
|
if (this.m_ckUndConstruct.exists()) {
|
|
|
int i = 0;
|
|
|
i = this.m_ckUndConstruct.getNumber("undConstructTemplates");
|
|
|
bool = (i > 0);
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
logger.warn("Error while getting value for cookie undConstructTemplates", exception);
|
|
|
}
|
|
|
return bool;
|
|
|
}
|
|
|
|
|
|
private String[] createRenderIcons(Vector paramVector) {
|
|
|
String[] arrayOfString = null;
|
|
|
int i = paramVector.size();
|
|
|
if (i > 0) {
|
|
|
arrayOfString = new String[i];
|
|
|
String[] arrayOfString1 = { "template_stage", "object_name" };
|
|
|
String[][] arrayOfString2 = null;
|
|
|
try {
|
|
|
arrayOfString2 = TCComponentType.getPropertiesSet(paramVector, arrayOfString1);
|
|
|
String str = null;
|
|
|
for (byte b = 0; b < i; b++) {
|
|
|
str = arrayOfString2[b][0];
|
|
|
if (str.equals("2")) {
|
|
|
arrayOfString[b] = "blank";
|
|
|
} else if (str.equals("1")) {
|
|
|
arrayOfString[b] = "underconstruction";
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
MessageBox messageBox = new MessageBox(exception);
|
|
|
messageBox.setVisible(true);
|
|
|
}
|
|
|
}
|
|
|
return arrayOfString;
|
|
|
}
|
|
|
|
|
|
public NewProcessDialog(NewProcessCommand paramNewProcessCommand) {
|
|
|
super(paramNewProcessCommand.parentFrame, paramNewProcessCommand, Boolean.FALSE);
|
|
|
System.out.println("<22><>ʼ<EFBFBD><CABC>ʾ<EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>̶Ի<CCB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>==");
|
|
|
this.switchOffUCTemplates = getUndConstructCookieValue();
|
|
|
this.session = paramNewProcessCommand.session;
|
|
|
this.pasteTargets = paramNewProcessCommand.targetArray;
|
|
|
this.m_value_CR_allow_alternate_procedures = paramNewProcessCommand.m_value_CR_allow_alternate_procedures;
|
|
|
TCComponent tCComponent = null;
|
|
|
Boolean bool = (Boolean)Activator.getDefault().getToggleProperty("subProcessToggleProperty");
|
|
|
if (bool != null && bool.booleanValue()) {
|
|
|
InterfaceAIFComponent[] arrayOfInterfaceAIFComponent = Activator.getDefault().getSelectionMediatorService().getTargetComponents();
|
|
|
for (byte b = 0; b < arrayOfInterfaceAIFComponent.length; b++) {
|
|
|
if (arrayOfInterfaceAIFComponent[b] instanceof TCComponentTask) {
|
|
|
tCComponent = (TCComponent)arrayOfInterfaceAIFComponent[b];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Activator.getDefault().setToggleProperty("subProcessToggleProperty", false, this);
|
|
|
if (tCComponent != null) {
|
|
|
this.creatorTask = tCComponent;
|
|
|
String str = null;
|
|
|
TCPreferenceService tCPreferenceService = null;
|
|
|
if (this.session != null) {
|
|
|
tCPreferenceService = this.session.getPreferenceService();
|
|
|
str = tCPreferenceService.getStringValue("EPM_multiple_processes_targets");
|
|
|
}
|
|
|
if (str != null && str.length() != 0 && str.trim().toLowerCase().equals("on")) {
|
|
|
this.inheritTargetsEnabled = true;
|
|
|
str = tCPreferenceService.getStringValue("EPM_sub_process_target_inheritance");
|
|
|
if (str != null && str.length() != 0 && str.trim().toLowerCase().equals("on"))
|
|
|
this.inheritTargetsSelected = true;
|
|
|
}
|
|
|
}
|
|
|
if (SwingUtilities.isEventDispatchThread()) {
|
|
|
initUI();
|
|
|
} else {
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() { NewProcessDialog.this.initUI(); }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void initUI() {
|
|
|
super.initUI();
|
|
|
System.out.println("<22><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
setPersistentDisplay(true);
|
|
|
if (this.creatorTask == null) {
|
|
|
setTitle(registry.getString("command.TITLE"));
|
|
|
} else {
|
|
|
setTitle(registry.getString("subprocess_command.TITLE"));
|
|
|
}
|
|
|
this.mainPanel.setLayout(new VerticalLayout());
|
|
|
//System.out.println(""+this.mainPanel.get);
|
|
|
this.inputPanel = new JPanel(new PropertyLayout());
|
|
|
this.templatePanel = new JPanel(new HorizontalLayout());
|
|
|
this.dialogIcon.setIcon(registry.getImageIcon("newProcess.ICON"));
|
|
|
if (this.creatorTask == null) {
|
|
|
this.processNameLabel = new JLabel(registry.getString("name"));
|
|
|
} else {
|
|
|
this.processNameLabel = new JLabel(registry.getString("subprocess_name"));
|
|
|
}
|
|
|
String str = TCSession.getServerEncodingName(this.session);
|
|
|
int i = TCConstants.getDefaultMaxNameSize(this.session);
|
|
|
FilterDocument filterDocument = new FilterDocument(i, str);
|
|
|
this.processNameTextField = new iTextField(filterDocument, "", 20, i, true, this.inputPanel);
|
|
|
this.processNameTextField.setBorder(new EtchedBorder());
|
|
|
System.out.println("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+this.processNameTextField.getText());
|
|
|
this.processDescLabel = new JLabel(registry.getString("description"));
|
|
|
filterDocument = new FilterDocument(240, str);
|
|
|
this.processDescTextArea = new iTextArea(filterDocument, "", 3, 40, this.inputPanel);
|
|
|
this.processDescTextArea.setLengthLimit(240);
|
|
|
this.processDescTextArea.setLineWrap(true);
|
|
|
this.processDescTextArea.setWrapStyleWord(true);
|
|
|
this.processDescScrollPane = new JScrollPane(this.processDescTextArea);
|
|
|
this.processDefinitionLabel = new JLabel(registry.getString("processDefinition"));
|
|
|
this.processDefinitionComboBox = new iComboBox();
|
|
|
this.processDefinitionComboBox.setAutoCompleteSuggestive(false);
|
|
|
this.processDefinitionComboBox.setMaximumRowCount(10);
|
|
|
this.processDefinitionComboBox.getTextField().setColumns(32);
|
|
|
this.processDefinitionComboBox.addKeyListener(new KeyListener() {
|
|
|
@Override
|
|
|
public void keyReleased(KeyEvent param1KeyEvent) {}
|
|
|
|
|
|
@Override
|
|
|
public void keyPressed(KeyEvent param1KeyEvent) {
|
|
|
if (NewProcessDialog.this.processDefinitionComboBox.getSelectedItemCount() < 1)
|
|
|
return;
|
|
|
|
|
|
System.out.println("<22><>ѡ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>:"+NewProcessDialog.this.processDefinitionComboBox.getSelectedItemCount());
|
|
|
Object object = NewProcessDialog.this.processDefinitionComboBox.getSelectedItem();
|
|
|
if (object != null && object instanceof TCComponentTaskTemplate) {
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
TCComponentTaskTemplate tCComponentTaskTemplate = (TCComponentTaskTemplate)object;
|
|
|
int i = NewProcessDialog.this.tabPanel.getSelectedIndex();
|
|
|
String str = NewProcessDialog.this.tabPanel.getTitleAt(i);
|
|
|
System.out.println("str:"+str);
|
|
|
if (str.equals(registry.getString("process"))) {
|
|
|
NewProcessDialog.this.processDesignerPanel.open(tCComponentTaskTemplate);
|
|
|
NewProcessDialog.this.processDesignerPanel.revalidate();
|
|
|
} else if (str.equals(registry.getString("assignAllTasks"))) {
|
|
|
int j = NewProcessDialog.this.processDefinitionComboBox.getSelectedIndex();
|
|
|
if (NewProcessDialog.this.curSelTemplateIndex != j) {
|
|
|
NewProcessDialog.this.curSelTemplateIndex = j;
|
|
|
NewProcessDialog.this.assignPanel.open(tCComponentTaskTemplate);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void keyTyped(KeyEvent param1KeyEvent) {}
|
|
|
});
|
|
|
this.processDefinitionComboBox.addActionListener(new ActionListener() {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent param1ActionEvent) {
|
|
|
if (NewProcessDialog.this.processDefinitionComboBox.getSelectedItemCount() < 1)
|
|
|
return;
|
|
|
Object object = NewProcessDialog.this.processDefinitionComboBox.getSelectedItem();
|
|
|
if (object instanceof TCComponentTaskTemplate) {
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
TCComponentTaskTemplate tCComponentTaskTemplate = (TCComponentTaskTemplate)object;
|
|
|
int i = NewProcessDialog.this.tabPanel.getSelectedIndex();
|
|
|
String str = NewProcessDialog.this.tabPanel.getTitleAt(i);
|
|
|
if (str.equals(registry.getString("process"))) {
|
|
|
NewProcessDialog.this.processDesignerPanel.open(tCComponentTaskTemplate);
|
|
|
NewProcessDialog.this.processDesignerPanel.revalidate();
|
|
|
} else if (str.equals(registry.getString("assignAllTasks"))) {
|
|
|
int j = NewProcessDialog.this.processDefinitionComboBox.getSelectedIndex();
|
|
|
if (NewProcessDialog.this.curSelTemplateIndex != j) {
|
|
|
NewProcessDialog.this.curSelTemplateIndex = j;
|
|
|
NewProcessDialog.this.assignPanel.open(tCComponentTaskTemplate);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.switchOffUCCheckBox = new JCheckBox(registry.getString("uctemplates"));
|
|
|
this.switchOffUCCheckBox.setSelected(!this.switchOffUCTemplates);
|
|
|
this.switchOffUCCheckBox.setEnabled(false);
|
|
|
boolean bool = false;
|
|
|
try {
|
|
|
TCComponentUser tCComponentUser = this.session.getUser();
|
|
|
bool = tCComponentUser.getTCProperty("is_member_of_dba").getLogicalValue();
|
|
|
} catch (Exception exception) {
|
|
|
MessageBox.post(this.parentFrame, exception);
|
|
|
return;
|
|
|
}
|
|
|
if (bool) {
|
|
|
this.switchOffUCCheckBox.setEnabled(true);
|
|
|
} else {
|
|
|
this.switchOffUCCheckBox.setVisible(false);
|
|
|
}
|
|
|
this.switchOffUCCheckBox.addItemListener(new ItemListener() {
|
|
|
@Override
|
|
|
public void itemStateChanged(ItemEvent param1ItemEvent) {
|
|
|
if (param1ItemEvent.getStateChange() == 1) {
|
|
|
NewProcessDialog.this.switchOffUCTemplates = false;
|
|
|
} else {
|
|
|
NewProcessDialog.this.switchOffUCTemplates = true;
|
|
|
}
|
|
|
NewProcessDialog.this.setUndConstructCookieValue(NewProcessDialog.this.switchOffUCTemplates);
|
|
|
NewProcessDialog.this.procListAll.clear();
|
|
|
NewProcessDialog.this.procList.clear();
|
|
|
NewProcessDialog.this.procListAssigned.clear();
|
|
|
NewProcessDialog.this.populateProcessDefList();
|
|
|
}
|
|
|
});
|
|
|
this.processFilterLabel = new JLabel(registry.getString("processFilter"));
|
|
|
this.allRadioButton = new JRadioButton(registry.getString("all"), this.currentSelection);
|
|
|
this.allRadioButton.addActionListener(new ActionListener() {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent param1ActionEvent) {
|
|
|
if (!NewProcessDialog.this.currentSelection) {
|
|
|
NewProcessDialog.this.populateProcessDefList();
|
|
|
NewProcessDialog.this.currentSelection = true;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.assignedRadioButton = new JRadioButton(registry.getString("assigned"), !this.currentSelection);
|
|
|
this.assignedRadioButton.addActionListener(new ActionListener() {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent param1ActionEvent) {
|
|
|
if (NewProcessDialog.this.currentSelection) {
|
|
|
NewProcessDialog.this.populateProcessDefList();
|
|
|
NewProcessDialog.this.currentSelection = false;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.filterRadioButtonGroup = new ButtonGroup();
|
|
|
this.filterRadioButtonGroup.add(this.allRadioButton);
|
|
|
this.filterRadioButtonGroup.add(this.assignedRadioButton);
|
|
|
this.tabPanel = new JTabbedPane();
|
|
|
if (this.pasteTargets != null) {
|
|
|
int j = this.pasteTargets.length;
|
|
|
this.attachments = new TCComponent[j];
|
|
|
for (byte b = 0; b < j; b++)
|
|
|
this.attachments[b] = (TCComponent)this.pasteTargets[b];
|
|
|
}
|
|
|
this.attachmentsPanel = new TaskAttachmentsPanel(this.session, this.attachments, this.desktop.getCurrentApplication());
|
|
|
this.attachmentsPanel.addAttachmentChangeListener(this);
|
|
|
this.attachmentsPanel.setPreferredSize(new Dimension(350, 250));
|
|
|
if (this.creatorTask != null) {
|
|
|
this.inheritTargetsCheckBox = new JCheckBox(registry.getString("inherit_targets"));
|
|
|
this.inheritTargetsCheckBox.setEnabled(this.inheritTargetsEnabled);
|
|
|
if (this.inheritTargetsEnabled) {
|
|
|
this.inheritTargetsCheckBox.setSelected(this.inheritTargetsSelected);
|
|
|
if (this.inheritTargetsSelected)
|
|
|
addInheritedTargets();
|
|
|
}
|
|
|
this.inheritTargetsCheckBox.addItemListener(new ItemListener() {
|
|
|
@Override
|
|
|
public void itemStateChanged(ItemEvent param1ItemEvent) {
|
|
|
if (param1ItemEvent.getStateChange() == 1) {
|
|
|
NewProcessDialog.this.inheritTargetsSelected = true;
|
|
|
NewProcessDialog.this.addInheritedTargets();
|
|
|
} else {
|
|
|
NewProcessDialog.this.inheritTargetsSelected = false;
|
|
|
NewProcessDialog.this.removeInheritedTargets();
|
|
|
}
|
|
|
if (NewProcessDialog.this.assignedRadioButton.isSelected() || NewProcessDialog.this.onlyAssigned)
|
|
|
NewProcessDialog.this.populateProcessDefList();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
this.processDesignerPanel = new ProcessDesignerApplicationPanel(this.session);
|
|
|
this.processDesignerPanel.initializeDisplay();
|
|
|
this.attachmentTabIcon = registry.getImageIcon("attachments.ICON");
|
|
|
this.processDesignerTabIcon = registry.getImageIcon("process.ICON");
|
|
|
this.tabPanel.addTab(registry.getString("attachments"), this.attachmentTabIcon, this.attachmentsPanel);
|
|
|
this.tabPanel.addTab(registry.getString("process"), this.processDesignerTabIcon, this.processDesignerPanel);
|
|
|
this.assignPanel = new AssignAllTasksPanel(this.session);
|
|
|
if (!this.inheritTargetsSelected) {
|
|
|
this.assignPanel.setTargetObjects(this.attachments);
|
|
|
} else {
|
|
|
int j = 0;
|
|
|
byte b = 0;
|
|
|
if (this.attachments != null)
|
|
|
j += this.attachments.length;
|
|
|
if (this.creatorTaskTargets != null)
|
|
|
j += this.creatorTaskTargets.length;
|
|
|
TCComponent[] arrayOfTCComponent = new TCComponent[j];
|
|
|
if (this.attachments != null)
|
|
|
for (byte b1 = 0; b1 < this.attachments.length; b1++)
|
|
|
arrayOfTCComponent[b++] = this.attachments[b1];
|
|
|
if (this.creatorTaskTargets != null)
|
|
|
for (byte b1 = 0; b1 < this.creatorTaskTargets.length; b1++)
|
|
|
arrayOfTCComponent[b++] = this.creatorTaskTargets[b1];
|
|
|
this.assignPanel.setTargetObjects(arrayOfTCComponent);
|
|
|
}
|
|
|
this.tabPanel.addTab(registry.getString("assignAllTasks"), this.assignPanel);
|
|
|
this.tabPanel.addChangeListener(new ChangeListener() {
|
|
|
@Override
|
|
|
public void stateChanged(ChangeEvent param1ChangeEvent) {
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
int i = ((JTabbedPane)param1ChangeEvent.getSource()).getSelectedIndex();
|
|
|
String str = NewProcessDialog.this.tabPanel.getTitleAt(i);
|
|
|
if (NewProcessDialog.this.processDefinitionComboBox.getSelectedItemCount() < 1)
|
|
|
return;
|
|
|
Object object = NewProcessDialog.this.processDefinitionComboBox.getSelectedItem();
|
|
|
if (object instanceof TCComponentTaskTemplate) {
|
|
|
TCComponentTaskTemplate tCComponentTaskTemplate = (TCComponentTaskTemplate)object;
|
|
|
if (str.equals(registry.getString("process"))) {
|
|
|
NewProcessDialog.this.processDesignerPanel.open(tCComponentTaskTemplate);
|
|
|
NewProcessDialog.this.processDesignerPanel.revalidate();
|
|
|
} else if (str.equals(registry.getString("assignAllTasks"))) {
|
|
|
int j = NewProcessDialog.this.processDefinitionComboBox.getSelectedIndex();
|
|
|
if (NewProcessDialog.this.curSelTemplateIndex != j) {
|
|
|
NewProcessDialog.this.curSelTemplateIndex = j;
|
|
|
NewProcessDialog.this.assignPanel.open(tCComponentTaskTemplate);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
this.inputPanel.add("1.1.right.top.preferred.preferred", this.processNameLabel);
|
|
|
this.inputPanel.add("1.2.center.center.preferred.preferred", this.processNameTextField);
|
|
|
this.inputPanel.add("2.1.right.top.preferred.preferred", this.processDescLabel);
|
|
|
this.inputPanel.add("2.2.center.center.preferred.preferred", this.processDescScrollPane);
|
|
|
this.inputPanel.add("3.1.right.top.preferred.preferred", this.processDefinitionLabel);
|
|
|
this.inputPanel.add("3.2.center.center", this.processDefinitionComboBox);
|
|
|
this.templatePanel.add("left.bind.center.center", this.switchOffUCCheckBox);
|
|
|
this.templatePanel.add("right.bind.center.center", this.assignedRadioButton);
|
|
|
this.templatePanel.add("right.bind.center.center", this.allRadioButton);
|
|
|
this.templatePanel.add("right.bind.center.center", this.processFilterLabel);
|
|
|
this.applyButton.setVisible(false);
|
|
|
this.mainPanel.add("top.bind.center.center", this.inputPanel);
|
|
|
this.mainPanel.add("top.bind.center.center", this.templatePanel);
|
|
|
if (this.creatorTask != null)
|
|
|
this.mainPanel.add("top.bind.center.center", this.inheritTargetsCheckBox);
|
|
|
this.mainPanel.add("top.bind", new Separator());
|
|
|
this.mainPanel.add("unbound.bind.center.top", this.tabPanel);
|
|
|
this.mainPanel.setPreferredSize(new Dimension(750, 600));
|
|
|
setMinimumSize(new Dimension(600, 600));
|
|
|
TCComponent tCComponent = null;
|
|
|
if (this.pasteTargets != null) {
|
|
|
tCComponent = (TCComponent)this.pasteTargets[0];
|
|
|
} else if (this.creatorTaskTargets != null && this.creatorTaskTargets.length > 0) {
|
|
|
tCComponent = this.creatorTaskTargets[0];
|
|
|
}
|
|
|
if (tCComponent != null) {
|
|
|
String str1 = tCComponent.toString();
|
|
|
if (str1.getBytes().length > i)
|
|
|
str1 = new String(str1.getBytes(), 0, i);
|
|
|
this.processNameTextField.setText(str1);
|
|
|
validate();
|
|
|
}
|
|
|
setModal(false);
|
|
|
pack();
|
|
|
UIUtilities.centerToScreen(this, 1.1D, 1.0D);
|
|
|
startLoadProcDefsOperation();
|
|
|
|
|
|
System.out.println("this.processFilterLabel:"+this.processFilterLabel.getText());
|
|
|
System.out.println("this.processNameLabel:"+this.processNameLabel.getText());
|
|
|
System.out.println("this.processDescLabel:"+this.processDescLabel.getText());
|
|
|
System.out.println("this.processDefinitionLabel:"+this.processDefinitionLabel.getText());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void stopPressed() {}
|
|
|
|
|
|
@Override
|
|
|
public void setPerformable(boolean paramBoolean) { this.okButton.setEnabled(paramBoolean); }
|
|
|
|
|
|
@Override
|
|
|
public boolean isPerformable() {
|
|
|
boolean bool = false;
|
|
|
if (this.processNameTextField.getText().length() > 0 && this.processDefinitionComboBox.isEnabled() && this.processDefinitionComboBox.getSelectedObject() != null)
|
|
|
bool = true;
|
|
|
return bool;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean showCloseButton() { return false; }
|
|
|
|
|
|
@Override
|
|
|
public void startCommandOperation() {
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
try {
|
|
|
this.selResourceList = this.assignPanel.getSelectedResources();
|
|
|
this.assignPanel.saveModifyAssignmentList();
|
|
|
this.newProcessOp = (NewProcessOperation)registry.newInstanceFor("newProcessOperation", new Object[] { this });
|
|
|
this.newProcessOp.addOperationListener(this);
|
|
|
this.newProcessOp.addPropertyChangeListener(this);
|
|
|
this.session.queueOperation(this.newProcessOp);
|
|
|
} catch (Exception exception) {
|
|
|
Debug.printStackTrace("NEWPROCESS", exception);
|
|
|
MessageBox.post(this.parentFrame, exception);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void startOperation(String paramString) {
|
|
|
super.startOperation(paramString);
|
|
|
this.processNameTextField.setEnabled(false);
|
|
|
this.processDefinitionComboBox.setEnabled(false);
|
|
|
this.processDescTextArea.setEnabled(false);
|
|
|
validate();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void endOperation() {
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() { NewProcessDialog.this.endOperation(); }
|
|
|
});
|
|
|
if (this.newProcessOp == null)
|
|
|
return;
|
|
|
this.newProcessOp.removeOperationListener(this);
|
|
|
if (!this.newProcessOp.isAbortRequested()) {
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
NewProcessDialog.this.applyButton.setVisible(false);
|
|
|
NewProcessDialog.this.processNameTextField.setEnabled(true);
|
|
|
NewProcessDialog.this.processDefinitionComboBox.setEnabled(true);
|
|
|
NewProcessDialog.this.processDescTextArea.setEnabled(true);
|
|
|
NewProcessDialog.this.processNameTextField.requestFocus();
|
|
|
NewProcessDialog.this.processNameTextField.selectAll();
|
|
|
NewProcessDialog.this.validate();
|
|
|
if (NewProcessDialog.this.newProcessOp.getSuccessFlag()) {
|
|
|
NewProcessDialog.this.okButton.setVisible(false);
|
|
|
NewProcessDialog.this.disposeDialog();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
if (this.newProcessOp.getSuccessFlag())
|
|
|
this.attachmentsPanel.removeAttachmentChangeListener(this);
|
|
|
} else {
|
|
|
if (Debug.isOn("NEWPROCESSUI")) {
|
|
|
Debug.println("------------------------------------------------");
|
|
|
Debug.println("====> Before cleaning up the process endOperation()...");
|
|
|
Debug.println("------------------------------------------------");
|
|
|
}
|
|
|
this.newProcessOp.cleanUp();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String getProcessName() { return this.processNameTextField.getText(); }
|
|
|
|
|
|
@Override
|
|
|
public String getProcessDescription() { return this.processDescTextArea.getText(); }
|
|
|
|
|
|
@Override
|
|
|
public String getProcessDefinition() { return this.processDefinitionComboBox.getSelectedItem().toString(); }
|
|
|
|
|
|
@Override
|
|
|
public Object getProcessTemplate() { return this.processDefinitionComboBox.getSelectedItem(); }
|
|
|
|
|
|
@Override
|
|
|
public TCComponent[] getAttachmentComponents() { return this.attachmentsPanel.getAttachments(); }
|
|
|
|
|
|
@Override
|
|
|
public int[] getAttachmentTypes() { return this.attachmentsPanel.getAttachmentTypes(); }
|
|
|
|
|
|
@Override
|
|
|
public TCSession getSession() { return this.session; }
|
|
|
|
|
|
@Override
|
|
|
public TCComponent getCreatorTask() { return this.creatorTask; }
|
|
|
|
|
|
private void addInheritedTargets() {
|
|
|
if (!this.inheritTargetsEnabled || !this.inheritTargetsSelected)
|
|
|
return;
|
|
|
try {
|
|
|
if (this.creatorTaskTargets == null)
|
|
|
this.creatorTaskTargets = ((TCComponentTask)this.creatorTask).getAttachments(TCAttachmentScope.GLOBAL, 1);
|
|
|
if (this.creatorTaskTargets.length > 0)
|
|
|
this.attachmentsPanel.insertTargetComponents(this.creatorTaskTargets);
|
|
|
} catch (Exception exception) {
|
|
|
MessageBox messageBox = new MessageBox(exception);
|
|
|
messageBox.setVisible(true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void removeInheritedTargets() {
|
|
|
try {
|
|
|
if (this.creatorTaskTargets == null)
|
|
|
this.creatorTaskTargets = ((TCComponentTask)this.creatorTask).getAttachments(TCAttachmentScope.GLOBAL, 1);
|
|
|
if (this.creatorTaskTargets.length > 0)
|
|
|
this.attachmentsPanel.removeTargetComponents(this.creatorTaskTargets);
|
|
|
} catch (Exception exception) {
|
|
|
MessageBox messageBox = new MessageBox(exception);
|
|
|
messageBox.setVisible(true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public TCComponent[] getAttachmentComponentsOfType(int paramInt) {
|
|
|
TCComponent[] arrayOfTCComponent = getAttachmentComponents();
|
|
|
int[] arrayOfInt = getAttachmentTypes();
|
|
|
if (arrayOfTCComponent == null || arrayOfTCComponent.length == 0)
|
|
|
return null;
|
|
|
Vector vector = new Vector();
|
|
|
for (byte b = 0; b < arrayOfTCComponent.length; b++) {
|
|
|
if (arrayOfInt[b] == paramInt)
|
|
|
vector.addElement(arrayOfTCComponent[b]);
|
|
|
}
|
|
|
return (TCComponent[])vector.toArray(new TCComponent[vector.size()]);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ResourceMember[] getSelectedResources() { return this.selResourceList; }
|
|
|
|
|
|
public void populateProcessDefList() {
|
|
|
this.processDefinitionComboBox.removeAllItems();
|
|
|
this.curSelTemplateIndex = -1;
|
|
|
if (this.allRadioButton.isSelected() && !this.onlyAssigned) {
|
|
|
int i = this.procListAll.size();
|
|
|
if (i < 1) {
|
|
|
getProcList(Boolean.valueOf(false));
|
|
|
i = this.procListAll.size();
|
|
|
}
|
|
|
if (i < 1) {
|
|
|
this.processDefinitionComboBox.setEnabled(true);
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
MessageBox.post(registry.getString("noProcessTemplateDefined"), registry.getString("error.TITLE"), 2);
|
|
|
return;
|
|
|
}
|
|
|
String[] arrayOfString = createRenderIcons(this.procListAll);
|
|
|
this.processDefinitionComboBox.addItems(this.procListAll.toArray(), arrayOfString);
|
|
|
this.processDefinitionComboBox.sort(arrayOfString);
|
|
|
if (Debug.isOn("NEWPROCESSUI")) {
|
|
|
Debug.println("------------------------------------------------");
|
|
|
Debug.println("====> ALL option: Set Selected Index ...");
|
|
|
Debug.println("------------------------------------------------");
|
|
|
}
|
|
|
} else if (this.assignedRadioButton.isSelected() || this.onlyAssigned) {
|
|
|
int i = this.procListAssigned.size();
|
|
|
if (i < 1) {
|
|
|
getProcList(Boolean.valueOf(true));
|
|
|
i = this.procListAssigned.size();
|
|
|
}
|
|
|
if (i > 0) {
|
|
|
String[] arrayOfString = createRenderIcons(this.procListAssigned);
|
|
|
this.processDefinitionComboBox.addItems(this.procListAssigned.toArray(), arrayOfString);
|
|
|
if (Debug.isOn("NEWPROCESSUI")) {
|
|
|
Debug.println("------------------------------------------------");
|
|
|
Debug.println("====> ASSIGNED option num > 0 : Set Selected Index ...");
|
|
|
Debug.println("------------------------------------------------");
|
|
|
}
|
|
|
}
|
|
|
Vector vector = filterTemplates();
|
|
|
if (this.filterInstancer != null)
|
|
|
if (vector != null) {
|
|
|
int j = vector.size();
|
|
|
logger.debug("Number of templates returned are ");
|
|
|
logger.debug(Integer.valueOf(j));
|
|
|
this.processDefinitionComboBox.removeAllItems();
|
|
|
for (byte b = 0; b < j; b++) {
|
|
|
if (vector.get(b) != null)
|
|
|
this.processDefinitionComboBox.addItem(vector.get(b));
|
|
|
}
|
|
|
} else {
|
|
|
logger.info("No templates returned");
|
|
|
this.processDefinitionComboBox.removeAllItems();
|
|
|
}
|
|
|
}
|
|
|
this.processDefinitionComboBox.setAutoCompleteSuggestive(false);
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
if (NewProcessDialog.this.processDefinitionComboBox.getItemCount() <= 0) {
|
|
|
NewProcessDialog.this.assignPanel.clearPanel();
|
|
|
} else {
|
|
|
NewProcessDialog.this.processDefinitionComboBox.setSelectedIndex(0);
|
|
|
NewProcessDialog.this.processDefinitionComboBox.updateSelections();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent) {
|
|
|
if (paramPropertyChangeEvent.getSource() == this.attachmentsPanel && paramPropertyChangeEvent.getPropertyName() == "attachment_changed") {
|
|
|
this.procListAssigned.removeAllElements();
|
|
|
if (this.assignedRadioButton.isSelected() || this.onlyAssigned) {
|
|
|
final Object selected = this.processDefinitionComboBox.getSelectedItem();
|
|
|
populateProcessDefList();
|
|
|
SwingUtilities.invokeLater(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
Object[] arrayOfObject = NewProcessDialog.this.processDefinitionComboBox.getItems();
|
|
|
if (arrayOfObject != null) {
|
|
|
boolean bool = false;
|
|
|
for (byte b = 0; b < arrayOfObject.length; b++) {
|
|
|
if (arrayOfObject[b] == selected) {
|
|
|
bool = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (bool) {
|
|
|
NewProcessDialog.this.processDefinitionComboBox.setSelectedItem(selected);
|
|
|
} else {
|
|
|
NewProcessDialog.this.processDefinitionComboBox.setSelectedIndex(0);
|
|
|
}
|
|
|
NewProcessDialog.this.processDefinitionComboBox.updateSelections();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void getProcList(Boolean paramBoolean) {
|
|
|
TCComponentTaskTemplate[] arrayOfTCComponentTaskTemplate = null;
|
|
|
try {
|
|
|
TCComponentTaskTemplateType tCComponentTaskTemplateType = (TCComponentTaskTemplateType)this.session.getTypeComponent("EPMTaskTemplate");
|
|
|
if (tCComponentTaskTemplateType != null)
|
|
|
if (!paramBoolean.booleanValue()) {
|
|
|
this.procListAll.clear();
|
|
|
arrayOfTCComponentTaskTemplate = tCComponentTaskTemplateType.getProcessTemplates(!this.switchOffUCTemplates, paramBoolean.booleanValue(), null, null, null);
|
|
|
if (arrayOfTCComponentTaskTemplate != null && arrayOfTCComponentTaskTemplate.length > 0)
|
|
|
this.procListAll.addAll(Arrays.asList(arrayOfTCComponentTaskTemplate));
|
|
|
} else {
|
|
|
this.procListAssigned.clear();
|
|
|
TCComponent[] arrayOfTCComponent = getAttachmentComponents();
|
|
|
arrayOfTCComponentTaskTemplate = tCComponentTaskTemplateType.getProcessTemplates(!this.switchOffUCTemplates, paramBoolean.booleanValue(), arrayOfTCComponent, null, null);
|
|
|
if (arrayOfTCComponentTaskTemplate != null && arrayOfTCComponentTaskTemplate.length > 0)
|
|
|
this.procListAssigned.addAll(Arrays.asList(arrayOfTCComponentTaskTemplate));
|
|
|
}
|
|
|
} catch (TCException tCException) {
|
|
|
logger.error(tCException.getClass().getName(), tCException);
|
|
|
MessageBox.post(this.parentFrame, tCException);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Deprecated
|
|
|
public void getProcListAll() {
|
|
|
TCComponentTaskTemplate[] arrayOfTCComponentTaskTemplate = null;
|
|
|
try {
|
|
|
TCComponentTaskTemplateType tCComponentTaskTemplateType = (TCComponentTaskTemplateType)this.session.getTypeComponent("EPMTaskTemplate");
|
|
|
if (tCComponentTaskTemplateType != null) {
|
|
|
try {
|
|
|
arrayOfTCComponentTaskTemplate = tCComponentTaskTemplateType.getProcessTemplates(!this.switchOffUCTemplates, false, null, null, null);
|
|
|
} catch (TCException tCException) {
|
|
|
MessageBox.post(this.parentFrame, tCException);
|
|
|
}
|
|
|
int i = 0;
|
|
|
if (arrayOfTCComponentTaskTemplate != null)
|
|
|
i = arrayOfTCComponentTaskTemplate.length;
|
|
|
this.procListAll.clear();
|
|
|
for (byte b = 0; b < i; b++)
|
|
|
this.procListAll.addElement(arrayOfTCComponentTaskTemplate[b]);
|
|
|
}
|
|
|
} catch (TCException tCException) {
|
|
|
MessageBox.post(this.parentFrame, tCException);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Deprecated
|
|
|
public void getProcListAssigned() {
|
|
|
try {
|
|
|
TCComponent[] arrayOfTCComponent = getAttachmentComponents();
|
|
|
int[] arrayOfInt = this.attachmentsPanel.getAttachmentTypes();
|
|
|
if (arrayOfTCComponent == null)
|
|
|
return;
|
|
|
int i = arrayOfTCComponent.length;
|
|
|
if (i == 0)
|
|
|
return;
|
|
|
HashSet hashSet = new HashSet();
|
|
|
for (byte b = 0; b < i; b++) {
|
|
|
if (arrayOfInt[b] == 1)
|
|
|
hashSet.add(arrayOfTCComponent[b].getType());
|
|
|
}
|
|
|
String[] arrayOfString = new String[hashSet.size()];
|
|
|
hashSet.toArray(arrayOfString);
|
|
|
TCComponentGroup tCComponentGroup = this.session.getGroup();
|
|
|
String str = tCComponentGroup.getFullName();
|
|
|
TCComponentTaskTemplate[] arrayOfTCComponentTaskTemplate = null;
|
|
|
TCComponentTaskTemplateType tCComponentTaskTemplateType = (TCComponentTaskTemplateType)this.session.getTypeComponent("EPMTaskTemplate");
|
|
|
if (tCComponentTaskTemplateType != null)
|
|
|
arrayOfTCComponentTaskTemplate = tCComponentTaskTemplateType.getProcessTemplates(!this.switchOffUCTemplates, true, null, arrayOfString, str);
|
|
|
int j = 0;
|
|
|
if (arrayOfTCComponentTaskTemplate != null)
|
|
|
j = arrayOfTCComponentTaskTemplate.length;
|
|
|
if (j > 0) {
|
|
|
this.procListAssigned.clear();
|
|
|
for (byte b1 = 0; b1 < j; b1++)
|
|
|
this.procListAssigned.addElement(arrayOfTCComponentTaskTemplate[b1]);
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
MessageBox.post(this.parentFrame, exception);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void initProcessDefList() {
|
|
|
byte b = 1;
|
|
|
if (this.m_value_CR_allow_alternate_procedures != null && this.m_value_CR_allow_alternate_procedures.length() > 0)
|
|
|
if (this.m_value_CR_allow_alternate_procedures.equalsIgnoreCase("ANY")) {
|
|
|
b = 1;
|
|
|
} else if (this.m_value_CR_allow_alternate_procedures.equalsIgnoreCase("none")) {
|
|
|
b = 2;
|
|
|
} else if (this.m_value_CR_allow_alternate_procedures.equalsIgnoreCase("Assigned")) {
|
|
|
b = 3;
|
|
|
}
|
|
|
if (b == 1) {
|
|
|
this.allRadioButton.doClick();
|
|
|
getProcList(Boolean.valueOf(false));
|
|
|
int i = this.procListAll.size();
|
|
|
this.procList.clear();
|
|
|
for (byte b1 = 0; b1 < i; b1++)
|
|
|
this.procList.addElement(this.procListAll.elementAt(b1));
|
|
|
} else if (b == 2) {
|
|
|
this.processFilterLabel.setVisible(false);
|
|
|
this.allRadioButton.setVisible(false);
|
|
|
this.assignedRadioButton.setVisible(false);
|
|
|
getProcList(Boolean.valueOf(true));
|
|
|
int i = this.procListAssigned.size();
|
|
|
this.onlyAssigned = true;
|
|
|
this.procList.clear();
|
|
|
for (byte b1 = 0; b1 < i; b1++)
|
|
|
this.procList.addElement(this.procListAssigned.elementAt(b1));
|
|
|
} else if (b == 3) {
|
|
|
this.processFilterLabel.setVisible(true);
|
|
|
this.allRadioButton.setVisible(true);
|
|
|
this.assignedRadioButton.setVisible(true);
|
|
|
this.assignedRadioButton.doClick();
|
|
|
getProcList(Boolean.valueOf(true));
|
|
|
int i = this.procListAssigned.size();
|
|
|
this.procList.clear();
|
|
|
for (byte b1 = 0; b1 < i; b1++)
|
|
|
this.procList.addElement(this.procListAssigned.elementAt(b1));
|
|
|
this.radioButtonFlag = 3;
|
|
|
}
|
|
|
revalidate();
|
|
|
repaint();
|
|
|
}
|
|
|
|
|
|
public void startLoadProcDefsOperation() {
|
|
|
this.loadOp = new LoadProcDefsOperation(Registry.getRegistry(this).getString("loadingDefTemplates"));
|
|
|
this.session.queueOperation(this.loadOp);
|
|
|
}
|
|
|
|
|
|
public Vector filterTemplates() {
|
|
|
Vector vector1 = null;
|
|
|
Vector vector2 = new Vector();
|
|
|
TemplateFilterService templateFilterService = TemplateFilterService.getInstance();
|
|
|
this.filterInstancer = templateFilterService.getTemplateFilter();
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
if (this.filterInstancer != null) {
|
|
|
getProcList(Boolean.valueOf(false));
|
|
|
try {
|
|
|
vector1 = this.filterInstancer.getFilteredTemplates(this.procListAll, this.procListAssigned, this.pasteTargets, this.session);
|
|
|
} catch (Exception exception) {
|
|
|
if (exception instanceof NoCustomFilteringRequiredException) {
|
|
|
logger.debug("Custom Filtering is not required. Passing the OOTB filtered templates for display");
|
|
|
return this.procListAssigned;
|
|
|
}
|
|
|
logger.error("Exception passed by the custom code", exception);
|
|
|
MessageBox.post(registry.getString("customCodeException"), registry.getString("error.TITLE"), 1);
|
|
|
return null;
|
|
|
}
|
|
|
try {
|
|
|
if (vector1 != null) {
|
|
|
int i = vector1.size();
|
|
|
for (byte b = 0; b < i; b++) {
|
|
|
if (vector1.get(b) != null && !vector2.contains(vector1.get(b)))
|
|
|
vector2.add(vector1.get(b));
|
|
|
}
|
|
|
}
|
|
|
if (vector2.size() > 0) {
|
|
|
boolean bool = this.procListAll.containsAll(vector2);
|
|
|
if (bool)
|
|
|
return vector2;
|
|
|
if (!bool) {
|
|
|
logger.error("Templates returned from custom code are invalid");
|
|
|
MessageBox.post(registry.getString("templatesNotInDatabase"), registry.getString("error.TITLE"), 1);
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception exception) {
|
|
|
logger.error("Exception", exception);
|
|
|
MessageBox.post(this.parentFrame, exception);
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
return vector2;
|
|
|
}
|
|
|
|
|
|
private class LoadProcDefsOperation extends AbstractAIFOperation {
|
|
|
public LoadProcDefsOperation(String param1String) { super(param1String); }
|
|
|
|
|
|
@Override
|
|
|
public void executeOperation() {
|
|
|
try {
|
|
|
NewProcessDialog.this.initProcessDefList();
|
|
|
if (isAbortRequested())
|
|
|
return;
|
|
|
} catch (Exception exception) {
|
|
|
Registry registry = Registry.getRegistry(this);
|
|
|
MessageBox.post(NewProcessDialog.this.parentFrame, registry.getString("loadProcDefsError"), "", registry.getString("error.TITLE"), 1);
|
|
|
return;
|
|
|
}
|
|
|
boolean bool = false;
|
|
|
try {
|
|
|
if (NewProcessDialog.this.m_value_CR_allow_alternate_procedures != null && NewProcessDialog.this.m_value_CR_allow_alternate_procedures.length() > 0 && NewProcessDialog.this.m_value_CR_allow_alternate_procedures.equalsIgnoreCase("Assigned"))
|
|
|
bool = true;
|
|
|
} catch (Exception exception) {
|
|
|
MessageBox.post(NewProcessDialog.this.parentFrame, exception);
|
|
|
}
|
|
|
if (!bool)
|
|
|
NewProcessDialog.this.populateProcessDefList();
|
|
|
NewProcessDialog.this.currentSelection = (NewProcessDialog.this.radioButtonFlag != 3);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public TCComponent[] getAttachmentComponentsByTypes(int[] arg0) {
|
|
|
// TODO Auto-generated method stub
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|