use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class Palette method createPaletteButton.
// Currently, expects images that are 20x20 pixels
public Button createPaletteButton(Image img, Control lastButton, Composite parent, Object buttonData, ButtonListener buttonListener, String toolTipText) {
buttonListener.setPalette(this);
// On OSX, we need to use flat buttons. On the PC, toggle is sufficient
int style = OSUtils.MACOSX ? (SWT.TOGGLE | SWT.FLAT) : SWT.TOGGLE;
Composite buttonBackground = new Composite(parent, SWT.NONE);
buttonBackground.setLayout(new FormLayout());
Button b = new Button(buttonBackground, style);
if (img != null) {
b.setImage(img);
}
FormData data = new FormData();
if (lastButton == null) {
// default first button to be selected
b.setSelection(true);
setData(b);
buttonBackground.setBackground(SELECTED_BKG);
data.top = new FormAttachment(0, 1);
data.bottom = new FormAttachment(0, 26);
} else {
Composite lastButtonBkg = lastButton.getParent();
data.top = new FormAttachment(lastButtonBkg, 0, SWT.BOTTOM);
data.bottom = new FormAttachment(lastButtonBkg, 25, SWT.BOTTOM);
}
data.left = new FormAttachment(0, 1);
data.right = new FormAttachment(0, 26);
buttonBackground.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(0, 1);
data.bottom = new FormAttachment(100, -1);
data.left = new FormAttachment(0, 1);
data.right = new FormAttachment(100, -1);
b.setLayoutData(data);
b.setData(buttonData);
b.addSelectionListener(buttonListener);
b.setToolTipText(toolTipText);
buttons.put(buttonData, b);
return b;
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class ScriptViewerView method layOutWindow.
/**
* Lay out the window including the interactionDrawing editor
*
* @param tableCallback
*/
public void layOutWindow(SWTListGroupScript rowRenderer) {
// Set up the layouts
getShell().setLayout(new FormLayout());
// Create a group for the properties on the history
Group widgetGroup = new Group(getShell(), SWT.NONE);
widgetGroup.setLayout(new FormLayout());
// Script
scriptStepListLabel = new Label(widgetGroup, SWT.CENTER);
scriptStepListLabel.setText(L10N.get("SE.ScriptStepList", "Script Step List: Double " + "click on a step to edit " + "its script"));
scriptStepListLabel.setBackground(NONEDITABLE_COLOR);
Table scriptStepTable = new Table(widgetGroup, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
scriptStepTable.setFont(FontUtils.SYMBOL_FONT);
scriptSteps = rowRenderer;
scriptSteps.setTable(scriptStepTable);
scriptSteps.setColumnTitles(columnTitles);
FormData editorData = new FormData();
editorData.top = new FormAttachment(0, 5);
editorData.left = new FormAttachment(0, 5);
editorData.bottom = new FormAttachment(100, -5);
FormData data = new FormData();
data.top = new FormAttachment(0, 5);
//data.left = new FormAttachment(sash, 0, SWT.RIGHT); //100, -1 * HISTORY_LIST_WIDTH);
data.right = new FormAttachment(100, -5);
data.bottom = new FormAttachment(100, -5);
//widgetGroup.setLayoutData(data);
SashUtility.createVerticalSash(getShell(), MIN_DRAWING_AREA_WIDTH, HISTORY_LIST_WIDTH, SWT.RIGHT, editor.bodyComposite, editorData, widgetGroup, data);
// Layout contents of widgetGroup
data = new FormData();
data.top = new FormAttachment(0, 0);
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);
data.bottom = new FormAttachment(100, -5);
scriptStepTable.setLayoutData(data);
layOutPropertiesPane(editor.propertiesComposite);
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class ScriptViewerView method layOutPropertiesPane.
/**
* Lay out the elements, and add listeners to communicate with "controller"
*/
protected void layOutPropertiesPane(Composite parent) {
// Create a group for the properties
Group widgetGroup = new Group(parent, SWT.NONE);
widgetGroup.setLayout(new FormLayout());
// Tell the parent to use a fill layout so it will fill the area.
parent.setLayout(new FillLayout());
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class SEDemoView method layOutPropertiesPane.
/**
* Lay out the elements, and add listeners to communicate with "controller"
*/
protected void layOutPropertiesPane(Composite parent) {
// Create a group for the properties
Group widgetGroup = new Group(parent, SWT.NONE);
widgetGroup.setLayout(new FormLayout());
// Tell the parent to use a fill layout so it will fill the area.
parent.setLayout(new FillLayout());
// Lay out the insert think button
insertThink = new Button(widgetGroup, SWT.PUSH);
insertThink.setText(L10N.get("SE.Think", "Think"));
insertThink.addSelectionListener(new SWTWidgetChangeHandler(SEDemoLID.InsertThink));
lIDMap.addWidget(SEDemoLID.InsertThink, insertThink, ListenerIdentifierMap.NORMAL);
// since driving is not currently supported hide that button
// this.insertDrive = new Button(widgetGroup, SWT.PUSH);
// this.insertDrive.setText(L10N.get("SE.AttendDriving",
// "Attend To Driving"));
// this.insertDrive.addSelectionListener(
// new WidgetChangeHandler(SEDemoLID.insertDrive));
// this.insertDrive.setVisible(false);
// Insert delay button.
// this.insertDelay = new Button(widgetGroup, SWT.PUSH);
// this.insertDelay.setText(L10N.get("SE.WaitForSystem",
// "Wait for System"));
// this.insertDelay.addSelectionListener(
// new SWTWidgetChangeHandler(SEDemoLID.InsertDelay));
//
// this.lIDMap.addWidget(SEDemoLID.InsertDelay,
// this.insertDelay,
// ListenerIdentifierMap.NORMAL);
// Insert the look at button
insertLookAt = new Button(widgetGroup, SWT.TOGGLE);
insertLookAt.setText(L10N.get("SE.LookAtWidget", "Look at Widget"));
lIDMap.addWidget(SEDemoLID.InsertLookAt, insertLookAt, ListenerIdentifierMap.NORMAL);
// The toggle button listener does not raise an alert,
// UIModel needs to listen for its state change
// on MacOSX, toggle button is not a standard size
// To make things line up nicely we add a -5 offset.
int displacementForWindows = 0;
if (OSUtils.MACOSX) {
// XXX: dirty hacks around SWT bugs
displacementForWindows = 5;
}
FormData data = new FormData();
data.left = new FormAttachment(0, 5);
data.top = new FormAttachment(insertThink, 0, SWT.CENTER);
// data.bottom = new FormAttachment(this.insertThink,
// // OSX Look At is larger,
// // so shift it down
// 0 - displacementForWindows,
// SWT.BOTTOM);
insertLookAt.setLayoutData(data);
data = new FormData();
data.left = new FormAttachment(insertLookAt, // OSXLook At is wider then normal.
5 + displacementForWindows, SWT.RIGHT);
// on windows leave space on edges, macOSX doesn't need it
data.bottom = new FormAttachment(100, -5 + displacementForWindows);
// this.insertDelay.setLayoutData(data);
//
// data = new FormData();
// data.left = new FormAttachment(this.insertDelay, 5, SWT.RIGHT);
// data.bottom = new FormAttachment(this.insertDelay, 0, SWT.BOTTOM);
insertThink.setLayoutData(data);
}
use of org.eclipse.swt.layout.FormLayout in project cogtool by cogtool.
the class SEFrameChooserView method layOutPropertyPanel.
protected void layOutPropertyPanel(int deviceTypes, SWTList rowRenderer) {
Composite propertiesComposite = editor.getSWTPropertiesComposite();
addHandOnKeyboardToStart(deviceTypes, propertiesComposite);
frameList = rowRenderer;
frameList.setTable(new Table(propertiesComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION));
demonstrateScriptButton = new Button(propertiesComposite, SWT.NONE);
demonstrateScriptButton.setText(startDemonstratingLabel);
shell.setDefaultButton(demonstrateScriptButton);
demonstrateScriptButton.addSelectionListener(new SWTWidgetChangeHandler(SEFrameChooserLID.OpenScriptEditor));
lIDMap.addWidget(SEFrameChooserLID.OpenScriptEditor, demonstrateScriptButton, ListenerIdentifierMap.NORMAL);
closeButton = new Button(propertiesComposite, SWT.NONE);
closeButton.setText(L10N.get("SE.Close", "Close"));
closeButton.addSelectionListener(new SWTWidgetChangeHandler(CogToolLID.CloseWindow));
propertiesComposite.setLayout(new FormLayout());
// First thing resides at the top
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 5);
data.right = new FormAttachment(100, 0);
positionStartLocParms(data);
frameList.getTable().setLayoutData(data);
data = new FormData();
data.bottom = new FormAttachment(100, 0);
data.left = new FormAttachment(0, 5);
demonstrateScriptButton.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(demonstrateScriptButton, 0, SWT.TOP);
data.left = new FormAttachment(demonstrateScriptButton, 5, SWT.RIGHT);
data.bottom = new FormAttachment(100, 0);
closeButton.setLayoutData(data);
SashUtility.createVerticalSash(editor.bodyComposite, FRAME_LIST_WIDTH, 250, SWT.RIGHT, propertiesComposite, editor.getPropFormData(), editor.scrollComposite, editor.getScrollFormData());
}
Aggregations