use of org.eclipse.swt.layout.FormData in project cogtool by cogtool.
the class ActionChangePropertySet method layOutVoiceComposite.
@Override
public void layOutVoiceComposite() {
// Center isCommand state checkbox to associated text
// Align checkbox 5 pixels from the right edge
FormData data = new FormData();
data.top = new FormAttachment(voiceText.getOuter(), 0, SWT.CENTER);
data.right = new FormAttachment(100, -5);
voiceIsCmd.setLayoutData(data);
// Center voice text label to its associated text vertically
// Attach label to 5 pixels from the properties left
data = new FormData();
data.top = new FormAttachment(voiceText.getOuter(), 0, SWT.CENTER);
data.left = leftAttachment;
voiceTextLabel.setLayoutData(data);
// Attach device command text to 5 pixels from the label's right
// Attach top 5 pixels from the top edge
// Attach right of combo to 5 before the isCommand checkbox
data = new FormData();
data.top = new FormAttachment(0, 5);
data.left = new FormAttachment(voiceTextLabel, 5, SWT.RIGHT);
data.right = new FormAttachment(voiceIsCmd, -5, SWT.LEFT);
voiceText.setLayoutData(data);
transitionDestinationLabelVoice.setVisible(false);
transitionDestinationNameVoice.setVisible(false);
}
use of org.eclipse.swt.layout.FormData in project cogtool by cogtool.
the class ActionPropertySet method layoutHelper.
@Override
public void layoutHelper() {
actionSettings = new Composite(parent, SWT.BORDER);
actionSettings.setLayout(actionSettingsLayout);
propLabel = new Label(parent, SWT.CENTER);
propLabel.setText(designPropertiesLabel);
Font labelFont = FontUtils.getAdjustedFont(propLabel.getFont(), SWT.BOLD);
propLabel.setFont(labelFont);
actionType = new DisplayLabel(parent, SWT.NONE);
actionType.setText(actionTypeLabel);
actionChoices = new ComboWithEnableFix(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
actionChoices.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
int currentSelection = actionChoices.getSelectionIndex();
if (currentSelection != chosenActionType) {
editTransitionParms.useWhichParts = choiceUseIndexes[currentSelection];
chosenActionType = currentSelection;
view.performAction(DesignEditorLID.EditTransition, editTransitionParms, true);
}
}
});
delayLabelLabel = new DisplayLabel(parent, SWT.NONE);
delayLabelLabel.setText(DELAY_LABEL_LABEL);
delayLabel = new View.PerformActionText(parent, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected boolean doChangeAction() {
Point labelSelection = getSelection();
if ("".equals(getText())) {
setText(TransitionDelay.DEFAULT_DELAY_LABEL);
labelSelection = null;
}
if (view.performAction(DesignEditorLID.ChangeDelay)) {
if (labelSelection != null) {
setSelection(labelSelection);
}
return true;
}
return false;
}
};
delayInSecsLabel = new DisplayLabel(parent, SWT.NONE);
delayInSecsLabel.setText(DELAY_DURATION_LABEL + ":");
secondsUnit = new Label(parent, SWT.NONE);
secondsUnit.setText(SECONDS);
delayInSecs = new View.PerformActionDouble(parent, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected void onModify() {
super.onModify();
delayLabel.setEnabled(getDoubleValue() > 0.0);
}
@Override
protected boolean doChangeAction() {
Point delaySelection = getSelection();
if (getDoubleValue() == 0.0) {
setText("");
delaySelection = null;
}
if (view.performAction(DesignEditorLID.ChangeDelay)) {
if (delaySelection != null) {
setSelection(delaySelection);
}
return true;
}
return false;
}
};
delayInSecs.setAllowNegative(false);
delayInSecs.setDecimalPlaces(3);
delayInSecs.moveAbove(delayLabel.getOuter());
FormData data = new FormData();
data.left = leftAttachment;
data.right = new FormAttachment(100, -5);
propLabel.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionChoices, 0, SWT.CENTER);
actionType.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(actionType, 5, SWT.RIGHT);
data.right = new FormAttachment(100, -5);
data.top = new FormAttachment(propLabel, 5, SWT.BOTTOM);
actionChoices.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionChoices, 5, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
actionSettings.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(actionSettings, 5, SWT.BOTTOM);
delayInSecsLabel.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(delayInSecsLabel, 5, SWT.BOTTOM);
data.width = 100;
delayInSecs.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(delayInSecs.getOuter(), 5, SWT.RIGHT);
data.top = new FormAttachment(delayInSecs.getOuter(), 0, SWT.CENTER);
secondsUnit.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(delayInSecs.getOuter(), 5, SWT.BOTTOM);
delayLabelLabel.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(delayLabelLabel, 5, SWT.BOTTOM);
data.right = new FormAttachment(100, -5);
delayLabel.setLayoutData(data);
emptyParms = createEmptyComposite();
layOutEmptyComposite();
multTransParms = new Composite(actionSettings, SWT.NONE);
multTransParms.setLayout(new FormLayout());
Label multTransLabel = new Label(multTransParms, SWT.WRAP);
multTransLabel.setText(noActionAvailableText);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(0, 5);
data.right = new FormAttachment(100, -5);
multTransLabel.setLayoutData(data);
frameParms = createFrameComposite();
}
use of org.eclipse.swt.layout.FormData 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.FormData in project cogtool by cogtool.
the class FramePropertiesPane method layOutWidgets.
protected void layOutWidgets() {
FormAttachment leftAttachment = new FormAttachment(0, 5);
FormData data = new FormData();
data.top = new FormAttachment(0, 5);
data.left = leftAttachment;
frameNameLabel.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(frameNameLabel, 5, SWT.BOTTOM);
data.left = leftAttachment;
data.right = new FormAttachment(100, -5);
frameName.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(frameName.getOuter(), 5);
data.left = leftAttachment;
imagePath.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(imagePath, 5);
data.left = leftAttachment;
data.right = new FormAttachment(100, -5);
imagePathText.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(imagePathText, 5, SWT.BOTTOM);
data.left = leftAttachment;
widgetTreeLabel.setLayoutData(data);
int rowCount = (eltGroupTreeLabel != null) ? 12 : 16;
data = new FormData();
data.top = new FormAttachment(widgetTreeLabel, 5, SWT.BOTTOM);
data.left = leftAttachment;
data.right = new FormAttachment(frameName.getOuter(), 0, SWT.RIGHT);
data.height = (rowCount * 19) - 1;
widgetTree.setLayoutData(data);
if (eltGroupTreeLabel != null) {
data = new FormData();
data.top = new FormAttachment(widgetTree, 5, SWT.BOTTOM);
data.left = leftAttachment;
eltGroupTreeLabel.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(eltGroupTreeLabel, 5, SWT.BOTTOM);
data.left = leftAttachment;
data.right = new FormAttachment(frameName.getOuter(), 0, SWT.RIGHT);
data.height = 68;
eltGroupTree.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(eltGroupTree, 5, SWT.BOTTOM);
data.left = leftAttachment;
implicitGroupTreeLabel.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(implicitGroupTreeLabel, 5, SWT.BOTTOM);
data.left = leftAttachment;
data.right = new FormAttachment(frameName.getOuter(), 0, SWT.RIGHT);
data.height = 68;
implicitGroupTree.setLayoutData(data);
}
}
use of org.eclipse.swt.layout.FormData in project cogtool by cogtool.
the class ActionPropertySet method layOutKeyboardComposite.
@Override
public void layOutKeyboardComposite() {
// Align checkbox 5 pixels from the left edge
FormData data = new FormData();
data.top = new FormAttachment(keyboardText.getOuter(), 5);
data.left = leftAttachment;
keyboardIsCmd.setLayoutData(data);
// Attach label to 5 pixels from the properties left
data = new FormData();
data.top = new FormAttachment(0, 5);
data.left = leftAttachment;
keyboardTextLabel.setLayoutData(data);
// Attach device command text to 5 pixels below the text label
// Attach right of combo to 5 before the edge
// Align left with the acceptable key label
data = new FormData();
data.top = new FormAttachment(keyboardTextLabel, 5);
data.left = new FormAttachment(keyboardTextLabel, 0, SWT.LEFT);
data.right = new FormAttachment(100, -5);
keyboardText.setLayoutData(data);
data = new FormData();
data.left = leftAttachment;
data.top = new FormAttachment(transitionDestinationNameKeyboard, 0, SWT.CENTER);
transitionDestinationLabelKeyboard.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(transitionDestinationLabelKeyboard, 5, SWT.RIGHT);
data.right = new FormAttachment(100, -5);
data.top = new FormAttachment(keyboardIsCmd, 5);
transitionDestinationNameKeyboard.setLayoutData(data);
transitionDestinationNameKeyboard.setVisible(true);
if (keyboardActionCombo != null) {
// Attach key action label to 5 pixels from the properties left
// Add some extra white space between this label and the checkbox
data = new FormData();
data.top = new FormAttachment(transitionDestinationNameKeyboard, 20);
data.left = new FormAttachment(keyboardTextLabel, 0, SWT.LEFT);
keyboardActionLabel.setLayoutData(data);
// Attach key action combo with device command text
// Attach key action combo to 5 pixels below the action label
// Attach right of combo to end of the properties space
data = new FormData();
data.top = new FormAttachment(keyboardActionLabel, 5);
data.left = new FormAttachment(keyboardTextLabel, 0, SWT.LEFT);
data.right = new FormAttachment(100, -5);
keyboardActionCombo.setLayoutData(data);
}
SelectionListener setResetListener = new SetResetDefaultsListener(setAsDefaultKeyboard, restoreDefaultsKeyboard) {
@Override
protected boolean haveValuesChanged() {
return isKeyboardChanged(originalProperties);
}
@Override
protected void enableDefaultButtons(boolean isReset) {
boolean defaultChanged = isKeyboardChanged(defaultProperties);
setAsDefaults.setEnabled(defaultChanged);
resetDefaults.setEnabled((!isReset) && haveValuesChanged());
}
@Override
protected void setDefaults(boolean isReset) {
String cmd = isReset ? originalProperties.keyboardString : getKeyboardString();
setKeyboardDefaults(getKeyboardPressType(), cmd, isKeyboardCmd());
}
@Override
protected void resetDefaults() {
resetKeyboard();
}
};
addDefaultButtons(keyboardParms, keyboardSpecials.DOWN, setAsDefaultKeyboard, restoreDefaultsKeyboard, setResetListener);
}
Aggregations