use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionChangePropertySet method createVoiceComposite.
@Override
protected Composite createVoiceComposite() {
Composite c = super.createVoiceComposite();
voiceChoice = new Button(actionComposite, SWT.RADIO);
voiceChoice.setData(new Integer(ActionSet.USE_VOICE));
voiceChoice.addSelectionListener(getActionChoiceListener());
voiceChoice.setText(VOICE_LABEL);
c.setData(voiceChoice);
if (actionSettingsLayout.topControl == null) {
setSelectedActionChoice(voiceChoice, c, voiceText);
}
return c;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionPropertySet method createEmptyComposite.
protected Composite createEmptyComposite() {
Composite c = new Composite(actionSettings, SWT.NONE);
c.setLayout(new FormLayout());
ListenerIdentifierMap lidMap = view.getLIDMap();
designNameLabel = new DisplayLabel(c, SWT.NONE);
designNameLabel.setText(nameLabel);
designName = new View.PerformActionText(c, SWT.SINGLE | SWT.BORDER) {
@Override
protected void onFocus() {
super.onFocus();
view.getTransmuter().setLIDEnabledState();
}
@Override
protected boolean doChangeAction() {
Design design = (Design) designName.getData();
DesignEditorUI.DesignRenameParameters parms = new DesignEditorUI.DesignRenameParameters(design, designName.getText());
boolean changed = view.performAction(ProjectLID.RenameDesign, parms, true);
if (!changed) {
designName.setText(design.getName());
}
return changed;
}
};
inputDevicesLabel = new DisplayLabel(c, SWT.NONE);
inputDevicesLabel.setText(L10N.get("APS.InputDevices", "Input Devices") + ":");
outputDevicesLabel = new DisplayLabel(c, SWT.NONE);
outputDevicesLabel.setText(L10N.get("APS.OutputDevices", "Output Devices") + ":");
for (int i = 0; i < DeviceType.DISPLAY_ORDER.length; i++) {
deviceButtons[i] = new Button(c, SWT.CHECK);
deviceButtons[i].setText(DeviceType.DISPLAY_ORDER[i].getName());
deviceButtons[i].setEnabled(false);
deviceButtons[i].setSelection(false);
}
addDevices = new Button(c, SWT.PUSH);
addDevices.setText(addDevicesLabel);
addDevices.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
view.performAction(DesignEditorLID.AddDesignDevices);
}
});
lidMap.addWidget(DesignEditorLID.AddDesignDevices, addDevices, ListenerIdentifierMap.NORMAL);
skinLabel = new DisplayLabel(c, SWT.NONE);
skinLabel.setText(DESIGN_SKIN);
skinCombo = new ComboWithEnableFix(c, SWT.DROP_DOWN | SWT.READ_ONLY);
for (int i = 1; i < SkinType.DISPLAY.length - 1; i++) {
// Don't allow None or Palm
skinCombo.add(SkinType.DISPLAY[i].getName());
}
skinCombo.select(0);
skinCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
switch(skinCombo.getSelectionIndex()) {
case 0:
default:
{
view.performAction(DesignEditorLID.SkinWireFrame);
break;
}
case 1:
{
view.performAction(DesignEditorLID.SkinMacOSX);
break;
}
case 2:
{
view.performAction(DesignEditorLID.SkinWinXP);
break;
}
}
}
});
frameTreeLabel = new DisplayLabel(c, SWT.NONE);
frameTreeLabel.setText(FRAMES);
frameTree = new Tree(c, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
frameTree.setLinesVisible(true);
updater = new TreeItemUpdater.FrameItemUpdater(frameTree);
return c;
}
use of org.eclipse.swt.widgets.Composite in project cogtool by cogtool.
the class ActionPropertySet method createGraffitiComposite.
@Override
protected Composite createGraffitiComposite() {
Composite c = super.createGraffitiComposite();
setAsDefaultGraffiti = createSetAsDefaultButton(c);
restoreDefaultsGraffiti = createRestoreDefaultsButton(c);
graffitiChoice = choiceStrings.size();
choiceStrings.add(GRAFFITI_LABEL);
choiceUseIndexes[graffitiChoice] = ActionSet.USE_GRAFFITI_WIDGET;
return c;
}
use of org.eclipse.swt.widgets.Composite 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.widgets.Composite 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;
}
Aggregations