use of edu.cmu.cs.hcii.cogtool.view.ActionChangePropertySet in project cogtool by cogtool.
the class NewActionChangeDialog method addMoreFields.
@Override
protected void addMoreFields() {
GridData reqLayout;
if (complaint != null) {
reqLayout = new GridData();
reqLayout.grabExcessHorizontalSpace = true;
reqLayout.horizontalSpan = 4;
complaintLabel = new Label(dialog, SWT.NONE);
complaintLabel.setText(complaint);
complaintLabel.setLayoutData(reqLayout);
complaintLabel.setFont(FontUtils.SYMBOL_FONT);
complaintMode = properties.useWhichParts;
}
reqLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
reqLayout.grabExcessHorizontalSpace = true;
reqLayout.horizontalSpan = 4;
Composite c = new Composite(dialog, SWT.NONE);
c.setLayoutData(reqLayout);
propertySet = new ActionChangePropertySet(deviceTypes, c, this) {
protected ActionProperties testEnableProps = new ActionProperties(ActionProperties.UNSET);
@Override
protected boolean userSelectedMode(int widgetMode) {
boolean enableOK = super.userSelectedMode(widgetMode);
if (complaintLabel != null) {
complaintLabel.setVisible(widgetMode == complaintMode);
}
return enableOK;
}
@Override
protected void enableOKButton(boolean enable) {
// the OK button should be otherwise enabled
if (enable) {
if ((transitionSrc != null) && (properties != null)) {
propertySet.getProperties(testEnableProps);
AAction action = testEnableProps.buildAction();
Transition existingTransition = transitionSrc.getTransition(action);
if ((action != null) && (existingTransition != null)) {
enable = false;
}
}
}
super.enableOKButton(enable);
}
};
propertySet.layOutPropertiesPane();
}
Aggregations