use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class FrameEditorView method layOutPropertiesPane.
/**
* Layout the properties pane, with the specific list of device types
* and the parent to lay them out in.
*/
protected void layOutPropertiesPane(int deviceTypes, Composite pane) {
pane.setLayout(new FormLayout());
actionSettings = new Composite(pane, SWT.BORDER);
actionSettings.setLayout(actionSettingsLayout);
frameParms = new FramePropertiesPane(actionSettings, SWT.NONE, this);
widgetParms = new WidgetPropertiesPane(actionSettings, SWT.NONE, this);
eltGroupParms = new EltGroupPropertiesPane(actionSettings, SWT.NONE, this);
propLabel = new Label(pane, SWT.CENTER);
propLabel.setText(FRAME_PROPERTIES);
Font labelFont = FontUtils.getAdjustedFont(propLabel.getFont(), SWT.BOLD);
propLabel.setFont(labelFont);
FormData data = new FormData();
data.right = new FormAttachment(100, -5);
data.left = new FormAttachment(0, 5);
data.top = new FormAttachment(0, 5);
propLabel.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(0, 5);
data.top = new FormAttachment(propLabel, 5, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
actionSettings.setLayoutData(data);
// To get N/A set
setWidgetName(null);
// To get N/A set
setWidgetTitle(null);
// To get N/A set
setWidgetAuxText(null);
widgetParms.hideAttributeWidgets();
widgetParms.setParameterChoices(deviceTypes);
actionSettingsLayout.topControl = frameParms;
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class ActionSet method createVoiceComposite.
protected Composite createVoiceComposite() {
Composite voiceComp = new Composite(actionSettings, SWT.NONE);
voiceComp.setLayout(new FormLayout());
voiceTextLabel = new DisplayLabel(voiceComp, SWT.NONE);
voiceTextLabel.setText(L10N.get("DE.VoiceTextCaption", "Spoken Input") + ":");
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionDestinationLabelVoice = createTransitionDestinationLabel(voiceComp);
transitionDestinationNameVoice = createTransitionDestinationName(voiceComp);
voiceText = createVoiceText(voiceComp);
voiceIsCmd = new Button(voiceComp, SWT.CHECK);
voiceIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
voiceIsCmd.addSelectionListener(deviceActionChange);
return voiceComp;
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class ActionSet method createTouchComposite.
protected Composite createTouchComposite() {
Composite touchComp = new Composite(actionSettings, SWT.NONE);
touchComp.setLayout(new FormLayout());
touchActionLabel = new DisplayLabel(touchComp, SWT.NONE);
touchActionLabel.setText(L10N.get("DE.ButtonActionCaption", "Action") + ":");
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionSourceLabelTouch = createTransitionSourceLabel(touchComp);
transitionSourceNameTouch = createTransitionSourceName(touchComp);
transitionDestinationLabelTouch = createTransitionDestinationLabel(touchComp);
transitionDestinationNameTouch = createTransitionDestinationName(touchComp);
touchActionCombo = new ComboWithEnableFix(touchComp, SWT.DROP_DOWN | SWT.READ_ONLY);
for (TapPressType element : TapPressType.DISPLAY) {
touchActionCombo.add(element.toString());
}
touchActionCombo.select(0);
touchActionCombo.addSelectionListener(widgetActionChange);
return touchComp;
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class ActionSet method createKeyComposite.
protected Composite createKeyComposite() {
Composite keyComp = new Composite(actionSettings, SWT.NONE);
keyComp.setLayout(new FormLayout());
keyboardTextLabel = new DisplayLabel(keyComp, SWT.NONE);
keyboardTextLabel.setText(L10N.get("DE.KeyboardTextCaption", "Text") + ":");
keyboardText = createKeyboardText(keyComp);
keyboardText.setFont(FontUtils.SYMBOL_FONT);
keyboardIsCmd = new Button(keyComp, SWT.CHECK);
keyboardIsCmd.setText(L10N.get("DE.IsCommand", "Is Command"));
keyboardIsCmd.addSelectionListener(deviceActionChange);
// TODO Why is this here rather than in its natural home in the
// overridden method in ActionPropertySet?
transitionDestinationLabelKeyboard = createTransitionDestinationLabel(keyComp);
transitionDestinationNameKeyboard = createTransitionDestinationName(keyComp);
/* TODO: add back in when single character stuff is straightened out
this.keyboardActionLabel = new DisplayLabel(keyComp, SWT.NONE);
this.keyboardActionLabel.setText(L10N.get("DE.KeyActionCaption",
"Action")
+ ":");
this.keyboardActionCombo =
new ComboWithEnableFix(keyComp,
SWT.DROP_DOWN | SWT.READ_ONLY);
for (int i = 0; i < KeyPressType.DISPLAY.length; i++) {
this.keyboardActionCombo.add(KeyPressType.DISPLAY[i].toString());
}
this.keyboardActionCombo.select(0);
this.keyboardActionCombo.addSelectionListener(this.deviceActionChange);
*/
SelectionListener insertSpecial = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
Control source = (Control) e.getSource();
keyboardText.insert((String) source.getData());
Point selection = keyboardText.getSelection();
keyboardText.setFocus();
keyboardText.setSelection(selection);
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
// TODO: replace alignTo with this.keyboardActionCombo when the above TODO is done!
// can't assign using ?: because Java is stupid
Control alignTo;
if (vertical) {
alignTo = transitionDestinationNameKeyboard;
} else {
alignTo = keyboardText.getOuter();
}
keyboardSpecials = new KeyboardSpecialChars(alignTo, insertSpecial, vertical);
return keyComp;
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class SEDemoView method layOutWindow.
/**
* Lay out the window including the interactionDrawing editor
* @param edit
*
* @param tableCallback
*/
public void layOutWindow(int deviceTypes, SWTListMultiColumn rowRenderer) {
Shell shell = getShell();
// Set up the layouts
shell.setLayout(new FormLayout());
// Create a group for the properties on the history
historyProperties = new Group(shell, SWT.NONE);
historyProperties.setLayout(new FormLayout());
if (editable) {
// Create the delete Item button
deleteItem = new Button(historyProperties, SWT.PUSH);
deleteItem.setText(L10N.get("SE.DeleteStep", "Delete Step"));
deleteItem.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.Delete));
lIDMap.addWidget(SEDemoLID.Delete, deleteItem, ListenerIdentifierMap.NORMAL);
// this.regenerateItem = new Button(this.historyProperties, SWT.PUSH);
// this.regenerateItem.setText(L10N.get("SE.RegenerateScript",
// "Regenerate Script"));
// this.regenerateItem.addSelectionListener(
// new SWTWidgetChangeHandler(SEDemoLID.RegenerateScript));
//
// this.lIDMap.addWidget(SEDemoLID.RegenerateScript,
// this.regenerateItem,
// ListenerIdentifierMap.NORMAL);
// Create the compute button
computeItem = new Button(historyProperties, SWT.PUSH);
computeItem.setText(COMPUTE);
computeItem.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.RecomputeScript));
lIDMap.addWidget(SEDemoLID.RecomputeScript, computeItem, ListenerIdentifierMap.NORMAL);
}
// Script
scriptStepListLabel = new Label(historyProperties, SWT.CENTER);
String scriptStepLabel = scriptStepListTitle;
if (!editable) {
scriptStepLabel += " (" + VIEW_ONLY + ")";
scriptStepListLabel.setBackground(NONEDITABLE_COLOR);
}
scriptStepListLabel.setText(scriptStepLabel);
Table scriptStepTable = new Table(historyProperties, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
scriptStepTable.setFont(FontUtils.SYMBOL_FONT);
scriptSteps = rowRenderer;
scriptSteps.setTable(scriptStepTable);
scriptSteps.setColumnTitles(columnTitles);
if (editable) {
addHandOnKeyboardToStart(deviceTypes, historyProperties);
}
predictionResult = new Label(shell, SWT.LEFT);
FormData editorData = new FormData();
editorData.top = new FormAttachment(0, 5);
editorData.left = new FormAttachment(0, 5);
editorData.bottom = new FormAttachment(100, -5);
Label predictionLabel = new Label(shell, SWT.LEFT);
predictionLabel.setText(predictionTitle);
predictionLabel.setFont(PREDICTION_LABEL_FONT);
Button showVisButton = new Button(shell, SWT.PUSH);
FormData data = new FormData();
data.top = new FormAttachment(showVisButton, 0, SWT.CENTER);
data.left = new FormAttachment(historyProperties, 5, SWT.LEFT);
predictionLabel.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(showVisButton, 0, SWT.CENTER);
data.left = new FormAttachment(predictionLabel, 5, SWT.RIGHT);
data.right = new FormAttachment(showVisButton, 0, SWT.LEFT);
predictionResult.setLayoutData(data);
showVisButton.setText(SHOW_VISUALIZATION);
data = new FormData();
data.top = new FormAttachment(0, 10);
data.right = new FormAttachment(historyProperties, 0, SWT.RIGHT);
showVisButton.setLayoutData(data);
showVisButton.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.ShowModelVisualization));
lIDMap.addWidget(SEDemoLID.ShowModelVisualization, showVisButton, ListenerIdentifierMap.NORMAL);
data = new FormData();
data.top = new FormAttachment(showVisButton, 2, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
data.bottom = new FormAttachment(100, -5);
SashUtility.createVerticalSash(getShell(), MIN_DRAWING_AREA_WIDTH, HISTORY_LIST_WIDTH, SWT.RIGHT, editor.bodyComposite, editorData, historyProperties, data);
// Layout contents of widgetGroup
data = new FormData();
data.top = new FormAttachment(predictionLabel, 0, SWT.BOTTOM);
data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
scriptStepListLabel.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(scriptStepListLabel, 5, SWT.BOTTOM);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
positionStartLocParms(data);
scriptStepTable.setLayoutData(data);
if (editable) {
data = new FormData();
data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
data.bottom = new FormAttachment(computeItem, 0, SWT.TOP);
deleteItem.setLayoutData(data);
// data = new FormData();
// data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
// data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
// data.bottom = new FormAttachment(this.computeItem, 0 , SWT.TOP);
// this.regenerateItem.setLayoutData(data);
data = new FormData();
// use 0 here, since internal frame is set to -05, fix internal frame
data.bottom = new FormAttachment(100, 0);
data.left = new FormAttachment(scriptStepTable, 0, SWT.LEFT);
data.right = new FormAttachment(scriptStepTable, 0, SWT.RIGHT);
computeItem.setLayoutData(data);
layOutPropertiesPane(editor.propertiesComposite);
}
}
Aggregations