use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class TaskTemplateEditor method addPage.
private void addPage(String section) {
ScrolledComposite scrolledComposite = new ScrolledComposite(getContainer(), SWT.V_SCROLL);
scrolledComposite.setLayout(new GridLayout());
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComposite.setAlwaysShowScrollBars(true);
Composite composite = new Composite(scrolledComposite, SWT.NONE);
composite.setLayout(new FillLayout());
// create the grid layout
GridLayout gl = new GridLayout();
gl.numColumns = PropertyEditor.COLUMNS;
gl.marginTop = 6;
gl.marginLeft = 3;
composite.setLayout(gl);
for (PropertyEditor propertyEditor : propertyEditors) {
boolean belongs;
if (section == null)
belongs = propertyEditor.getSection() == null;
else
belongs = section.equals(propertyEditor.getSection());
if (belongs) {
if ("Notices".equals(propertyEditor.getName())) {
// special handling for notices
String attrVal = taskTemplate.getAttribute(TaskAttributeConstant.NOTICES);
if (StringHelper.isEmpty(attrVal) || attrVal.equals("$DefaultNotices"))
taskTemplate.setAttribute(TaskAttributeConstant.NOTICES, TaskVO.getDefaultNotices());
if (noticesValueChangeListener != null)
taskTemplate.removeAttributeValueChangeListener(noticesValueChangeListener);
noticesValueChangeListener = new NoticesValueChangeListener(propertyEditor);
taskTemplate.addAttributeValueChangeListener(noticesValueChangeListener);
propertyEditor.render(composite);
} else if ("Variables".equals(propertyEditor.getName())) {
// special handling for variables
TableEditor tableEditor = (TableEditor) propertyEditor;
// support for value expressions
tableEditor.setCellModifier(tableEditor.new DefaultCellModifier() {
@Override
public boolean canModify(Object element, String property) {
boolean editable = super.canModify(element, property);
if (editable && getColumnIndex(property) == 1) {
for (VariableVO var : getProcessVariables()) {
if (var.getName().equals(getValue(element, property)))
// can't edit process var rows
return false;
}
}
return editable;
}
});
tableEditor.setHorizontalSpan(4);
propertyEditor.render(composite);
tableEditor.getAddButton().setText("Expression");
GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.widthHint = 80;
tableEditor.getAddButton().setLayoutData(gridData);
final Button deleteBtn = tableEditor.getDeleteButton();
tableEditor.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
if (sel.getFirstElement() instanceof DefaultRowImpl) {
DefaultRowImpl row = (DefaultRowImpl) sel.getFirstElement();
for (VariableVO var : getProcessVariables()) {
if (var.getName().equals(row.getColumnValue(1))) {
deleteBtn.setEnabled(false);
return;
}
}
deleteBtn.setEnabled(true);
} else {
deleteBtn.setEnabled(false);
}
}
});
} else {
propertyEditor.render(composite);
}
propertyEditor.setValue(taskTemplate);
if (!propertyEditor.getType().equals(PropertyEditor.TYPE_LINK)) {
propertyEditor.setEditable(!(propertyEditor.isReadOnly() || taskTemplate.isReadOnly()));
}
}
}
scrolledComposite.setContent(composite);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
String pageName = section == null ? "General" : section;
setPageText(addPage(scrolledComposite), pageName);
pages.put(pageName, scrolledComposite);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class TaskTemplateEditor method reconcileVariables.
private void reconcileVariables() {
if (process == null) {
// TODO: find process with AutoFormManualTask activity which
// references this template
// (so that new variables population does not rely on opening from
// process editor)
}
if (process != null) {
processVariables = process.getVariables();
// reflect newly-added process variables
String attrVal = taskTemplate.getAttribute("Variables");
attrVal = TaskVO.updateVariableInString(attrVal, getProcessVariables());
taskTemplate.setAttribute("Variables", attrVal);
for (PropertyEditor propertyEditor : propertyEditors) {
if ("Variables".equals(propertyEditor.getName())) {
propertyEditor.setValue(taskTemplate);
break;
}
}
}
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class ProjectPermissionsSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
project = (WorkflowProject) selection;
// user text field
userEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
userEditor.setLabel("Current User");
userEditor.setWidth(150);
userEditor.setReadOnly(true);
userEditor.render(composite);
// edit processes checkbox
editProcessesEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
editProcessesEditor.setLabel("Design/Edit Processes");
editProcessesEditor.setReadOnly(true);
editProcessesEditor.render(composite);
// run processes checkbox
runProcessesEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
runProcessesEditor.setLabel("Execute Processes");
runProcessesEditor.setReadOnly(true);
runProcessesEditor.render(composite);
// admin checkbox
adminPermissionsEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
adminPermissionsEditor.setLabel("Administrator Privileges");
adminPermissionsEditor.setReadOnly(true);
adminPermissionsEditor.render(composite);
// sys admin checkbox
sysAdminPermissionsEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
sysAdminPermissionsEditor.setLabel("System Admin Privileges");
sysAdminPermissionsEditor.setReadOnly(true);
sysAdminPermissionsEditor.render(composite);
// task manager link
taskManagerLinkEditor = new PropertyEditor(project, PropertyEditor.TYPE_LINK);
taskManagerLinkEditor.setLabel("Launch Task Manager to Change Role Assignments");
taskManagerLinkEditor.setIndent(-100);
taskManagerLinkEditor.setHeight(20);
taskManagerLinkEditor.setWidth(500);
taskManagerLinkEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
launchTaskManager();
}
});
taskManagerLinkEditor.render(composite);
// reload button
reloadButtonEditor = new PropertyEditor(project, PropertyEditor.TYPE_BUTTON);
reloadButtonEditor.setLabel("Reload");
reloadButtonEditor.setIndent(-100);
reloadButtonEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
reloadPermissions();
}
});
reloadButtonEditor.render(composite);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class ProjectVcsSection method setSelection.
public void setSelection(WorkflowElement selection) {
if (project != null)
project.removeElementChangeListener(this);
project = (WorkflowProject) selection;
project.addElementChangeListener(this);
// dispose controls to render dynamically
if (gitRepoUrlEditor != null)
gitRepoUrlEditor.dispose();
if (gitBranchEditor != null)
gitBranchEditor.dispose();
if (assetLocalPathEditor != null)
assetLocalPathEditor.dispose();
if (gitSyncEditor != null)
gitSyncEditor.dispose();
if (includeArchiveEditor != null)
includeArchiveEditor.dispose();
// repository url text field
gitRepoUrlEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
gitRepoUrlEditor.setLabel("Git Repository URL");
gitRepoUrlEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getMdwVcsRepository().setRepositoryUrlWithCredentials(((String) newValue).trim());
project.getMdwVcsRepository().setEntrySource("projectSection");
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwVcsRepository());
}
});
gitRepoUrlEditor.render(composite);
gitRepoUrlEditor.setValue(project.getMdwVcsRepository().getRepositoryUrlWithMaskedCredentials());
gitRepoUrlEditor.setEditable(!project.isReadOnly());
// git branch text field
gitBranchEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
gitBranchEditor.setLabel("Git Branch");
gitBranchEditor.setWidth(200);
gitBranchEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getMdwVcsRepository().setBranch(((String) newValue).trim());
project.getMdwVcsRepository().setEntrySource("projectSection");
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwVcsRepository());
}
});
gitBranchEditor.render(composite);
gitBranchEditor.setValue(project.getMdwVcsRepository().getBranch());
gitBranchEditor.setEditable(!project.isReadOnly());
// asset local path text field
assetLocalPathEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
assetLocalPathEditor.setLabel("Asset Local Path");
assetLocalPathEditor.setWidth(200);
assetLocalPathEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getMdwVcsRepository().setLocalPath(((String) newValue).trim());
project.getMdwVcsRepository().setEntrySource("projectSection");
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwVcsRepository());
}
});
assetLocalPathEditor.render(composite);
assetLocalPathEditor.setValue(project.getMdwVcsRepository().getLocalPath());
assetLocalPathEditor.setEditable(!project.isReadOnly());
if (project.isRemote()) {
if (project.isGitVcs()) {
// for git: sync switch
gitSyncEditor = new PropertyEditor(project, PropertyEditor.TYPE_SWITCH);
gitSyncEditor.setLabel("");
// gitSyncEditor.setComment("(Unlock to enable asset editing)");
gitSyncEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
boolean unlocked = Boolean.parseBoolean(newValue.toString());
if (unlocked) {
WorkflowProjectManager.getInstance().makeLocal(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwVcsRepository());
MessageDialog.openInformation(getShell(), "Remote Project Unlocked", project.getName() + " has been unlocked. Please close any open assets and refresh.");
}
}
});
gitSyncEditor.render(composite);
SwitchButton switchBtn = (SwitchButton) gitSyncEditor.getWidget();
switchBtn.setTextForSelect("Synced");
switchBtn.setTextForUnselect("Unlocked");
gitSyncEditor.setValue(false);
}
// include archive checkbox
includeArchiveEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
includeArchiveEditor.setLabel("Sync Asset Archive");
includeArchiveEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getMdwVcsRepository().setSyncAssetArchive(Boolean.parseBoolean(newValue.toString()));
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwVcsRepository());
}
});
includeArchiveEditor.render(composite);
includeArchiveEditor.setValue(project.getMdwVcsRepository().isSyncAssetArchive());
includeArchiveEditor.setEditable(true);
}
composite.layout(true);
}
use of com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor in project mdw-designer by CenturyLinkCloud.
the class PropertySection method createSaveButton.
/**
* For override attributes.
*/
protected PropertyEditor createSaveButton() {
savePropertyEditor = new PropertyEditor(selection, PropertyEditor.TYPE_BUTTON);
savePropertyEditor.setLabel("Save");
savePropertyEditor.setWidth(65);
savePropertyEditor.setComment(" ");
savePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
saveOverrideAttributes();
}
});
savePropertyEditor.render(composite);
savePropertyEditor.setEnabled(selection.isOverrideAttributeDirty(getOverrideAttributePrefix()));
return savePropertyEditor;
}
Aggregations