use of org.eclipse.swt.widgets.Label in project cogtool by cogtool.
the class ThreadProgressBar method addAboveBar.
@Override
protected void addAboveBar() {
shell.setLayout(new FormLayout());
// Add status display area if requested
if (initialStatus != null) {
statusLabel = new Label(shell, SWT.NONE);
statusLabel.setText(initialStatus);
FormData data = new FormData();
data.left = new FormAttachment(0, 20);
data.top = new FormAttachment(0, 10);
data.right = new FormAttachment(100, -20);
statusLabel.setLayoutData(data);
}
}
use of org.eclipse.swt.widgets.Label in project cogtool by cogtool.
the class AboutView method buildDialog.
@Override
public void buildDialog() {
GridLayout layout = new GridLayout(4, false);
if (OSUtils.MACOSX) {
layout.marginLeft = 21;
layout.marginRight = 21;
layout.marginTop = 10;
layout.marginBottom = 15;
}
dialog.setLayout(layout);
// Centered logo, filling width
Label logo = new Label(dialog, SWT.CENTER);
logo.setImage(logoImg);
GridData imgLayout = new GridData();
imgLayout.horizontalSpan = 4;
imgLayout.horizontalAlignment = GridData.FILL;
imgLayout.grabExcessHorizontalSpace = true;
logo.setLayoutData(imgLayout);
// Current version, centered
Text version = new Text(dialog, SWT.CENTER | SWT.READ_ONLY);
GridData versionLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
versionLayout.horizontalSpan = 4;
version.setLayoutData(versionLayout);
version.setText(CogTool.getVersion());
// Copyright and URL (as Link), centered
Label copyright = new Label(dialog, SWT.NONE);
GridData copyrightLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
copyrightLayout.horizontalSpan = 4;
copyright.setLayoutData(copyrightLayout);
// © is the (c) copyright symbol
copyright.setText(L10N.get("CT.Copyright", "© 2012 CogTool@Carnegie Mellon University"));
// Be careful if you modify the following: the SWT Link object seems
// to behave most bizarrely if you combine a tilde in the middle of
// a URL with a trailing slash at its end.
addLink("Download updates from", L10N.get("CT.MainURL", "https://github.com/cogtool/cogtool/releases/latest"));
addLink("Documentation", L10N.get("CT.UserGuideURL", "https://github.com/cogtool/cogtool/releases/download/1.2.2/CogToolUserGuide_1_2.pdf"));
Label memory = new Label(dialog, SWT.NONE);
GridData memoryLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
memoryLayout.horizontalSpan = 4;
memory.setLayoutData(memoryLayout);
memory.setText(CogTool.getMemoryUsage());
Label props = new Label(dialog, SWT.NONE);
GridData propsLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
propsLayout.horizontalSpan = 4;
props.setLayoutData(propsLayout);
props.setText(CogTool.getConfigurationProperties());
addButtons();
}
use of org.eclipse.swt.widgets.Label 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.Label 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.widgets.Label 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