use of org.eclipse.swt.widgets.Composite 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();
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class Keypad method makeNumbers.
/**
* Creates and lays out the buttons for the keypad's number pad.
*
* @author Paul Rubritz (ptr@andrew.cmu.edu)
*/
protected void makeNumbers() {
GridLayout grid = new GridLayout();
grid.numColumns = 3;
GridData gridKeysOption = new GridData();
gridKeysOption.horizontalIndent = (keypadType == FULL_KEYPAD) ? 60 : 0;
gridKeysOption.verticalAlignment = SWT.TOP;
Composite numbers = new Composite(dialog, SWT.NONE);
numbers.setLayoutData(gridKeysOption);
numbers.setLayout(grid);
Button keypadButton;
for (int i = 0; i < numberKeys.length; i++) {
gridKeysOption = new GridData();
if (i < numberKeys.length - 1) {
gridKeysOption.widthHint = 50;
} else if (keypadType == NUMPAD_ONLY) {
gridKeysOption.widthHint = 160;
gridKeysOption.horizontalSpan = 3;
} else {
break;
}
gridKeysOption.heightHint = 50;
keypadButton = makeButton(numbers, numberKeys[i], gridKeysOption);
// (see IntegerEntry)
if ((keypadType == NUMPAD_ONLY) && numberKeys[i].equals("-")) {
keypadButton.setBackground(getDisabledColor());
keypadButton.setEnabled(false);
}
}
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionSet method createGraffitiComposite.
protected Composite createGraffitiComposite() {
Composite graffitiComp = new Composite(actionSettings, SWT.NONE);
graffitiComp.setLayout(new FormLayout());
graffitiTextLabel = new DisplayLabel(graffitiComp, SWT.NONE);
graffitiTextLabel.setText(L10N.get("DE.GraffitiTextCaption", "Graffiti® Gestures") + ":");
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionSourceLabelGraffiti = createTransitionSourceLabel(graffitiComp);
transitionSourceNameGraffiti = createTransitionSourceName(graffitiComp);
transitionDestinationLabelGraffiti = createTransitionDestinationLabel(graffitiComp);
transitionDestinationNameGraffiti = createTransitionDestinationName(graffitiComp);
// TODO: set desired width to something somewhat larger
graffitiText = createGraffitiText(graffitiComp);
graffitiIsCmd = new Button(graffitiComp, SWT.CHECK);
graffitiIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
graffitiIsCmd.addSelectionListener(widgetActionChange);
return graffitiComp;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionChangePropertySet method createKeyComposite.
@Override
protected Composite createKeyComposite() {
Composite c = super.createKeyComposite();
keyboardChoice = new Button(actionComposite, SWT.RADIO);
keyboardChoice.setData(new Integer(ActionSet.USE_KEYBOARD));
keyboardChoice.addSelectionListener(getActionChoiceListener());
keyboardChoice.setText(KEYBOARD_LABEL);
c.setData(keyboardChoice);
if (actionSettingsLayout.topControl == null) {
setSelectedActionChoice(keyboardChoice, c, keyboardText);
}
return c;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionChangePropertySet method createMouseComposite.
@Override
protected Composite createMouseComposite() {
Composite c = super.createMouseComposite();
mouseChoice = new Button(actionComposite, SWT.RADIO);
mouseChoice.setData(new Integer(ActionSet.USE_MOUSE));
mouseChoice.addSelectionListener(getActionChoiceListener());
mouseChoice.setText(MOUSE_LABEL);
c.setData(mouseChoice);
if (actionSettingsLayout.topControl == null) {
setSelectedActionChoice(mouseChoice, c, mouseButtonCombo);
}
return c;
}
Aggregations