use of com.centurylink.mdw.model.value.event.BamMessageDefinition in project mdw-designer by CenturyLinkCloud.
the class PropertyEditor method createBamEventComposer.
private BamEventComposer createBamEventComposer(Composite parent) {
createLabel(parent, 5);
final BamEventComposer composer = new BamEventComposer(parent, style, width, isReadOnly());
composer.setElement(getElement());
GridData gd = new GridData(SWT.LEFT);
gd.horizontalSpan = COLUMNS - 1;
gd.horizontalIndent = indent;
composer.setLayoutData(gd);
composer.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
BamMessageDefinition bamMsgDef = composer.getBamMessage();
value = valueConverter.toPropertyValue(bamMsgDef);
fireValueChanged(bamMsgDef);
}
});
return composer;
}
use of com.centurylink.mdw.model.value.event.BamMessageDefinition in project mdw-designer by CenturyLinkCloud.
the class BamMonitoringSection method saveOverrideAttributes.
@Override
protected void saveOverrideAttributes() {
// remove empty bam defs
Map<String, BamMessageDefinition> defs = new HashMap<String, BamMessageDefinition>();
for (String key : bamEventDefs.keySet()) {
BamMessageDefinition def = bamEventDefs.get(key);
def.setAttributes(removeEmpty(def.getAttributes()));
if (!def.isEmpty())
defs.put(key, def);
}
bamEventDefs = defs;
// sync attributes
for (String overrideAttr : getOverrideAttributes().keySet()) {
if (!bamEventDefs.containsKey(overrideAttr))
// to delete
element.setAttribute(overrideAttr, null);
}
try {
for (String key : bamEventDefs.keySet()) element.setAttribute(key, bamEventDefs.get(key).format());
String msg = bamEvtVal.validateBamEventAttributes(bamEventDefs);
if (msg.length() > 0) {
msg += "\n Please correct the above errors before you continue.";
MessageDialog.openError(getShell(), "Save Monitoring Attributes", msg);
} else {
super.saveOverrideAttributes();
}
} catch (MbengException ex) {
PluginMessages.uiError(getShell(), ex, "Save Monitoring Attributes", element.getProject());
}
}
use of com.centurylink.mdw.model.value.event.BamMessageDefinition in project mdw-designer by CenturyLinkCloud.
the class BamMonitoringSection method drawWidgets.
public void drawWidgets(Composite composite, WorkflowElement selection) {
element = (WorkflowElement) selection;
// trigger dropdown
triggerPropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_COMBO);
triggerPropertyEditor.setLabel("BAM Trigger");
triggerPropertyEditor.setWidth(100);
triggerPropertyEditor.setReadOnly(true);
ArrayList<String> triggerOpts = new ArrayList<String>();
triggerOpts.add("Start");
triggerOpts.add("Finish");
triggerPropertyEditor.setValueOptions(triggerOpts);
triggerPropertyEditor.setFireDirtyStateChange(false);
triggerPropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
if (newValue.equals("Start"))
selectedTrigger = WorkAttributeConstant.BAM_START_MSGDEF;
else if (newValue.equals("Finish"))
selectedTrigger = WorkAttributeConstant.BAM_FINISH_MSGDEF;
if (bamEventDefs.get(selectedTrigger) == null) {
bamEventDefs.put(selectedTrigger, getValue(selectedTrigger));
}
bamMessagePropertyEditor.setValue(bamEventDefs.get(selectedTrigger));
// otherwise
bamMessagePropertyEditor.setEditable(isEditable());
// reverts
// Add/Delete
// buttons
// to
// enabled
}
});
triggerPropertyEditor.render(composite);
separatorPropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_SEPARATOR);
separatorPropertyEditor.setWidth(500);
separatorPropertyEditor.render(composite);
// bam message def
bamMessagePropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_BAM_MESSAGE);
bamMessagePropertyEditor.setLabel("BAM Message");
bamMessagePropertyEditor.setWidth(500);
bamMessagePropertyEditor.setFireDirtyStateChange(false);
bamMessagePropertyEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
BamMessageDefinition bamMessageDef = (BamMessageDefinition) newValue;
bamEventDefs.put(selectedTrigger, bamMessageDef);
element.setAttribute(selectedTrigger, valueConverter.toPropertyValue(bamMessageDef));
setDirty(true);
}
});
bamMessagePropertyEditor.render(composite);
createSaveButton();
// help link
// spacer
new Label(composite, SWT.NONE);
helpPropertyEditor = new PropertyEditor(element, PropertyEditor.TYPE_LINK);
helpPropertyEditor.setLabel("BAM Monitoring Help");
helpPropertyEditor.render(composite);
helpPropertyEditor.setValue("/MDWHub/doc/bam.html");
}
Aggregations