use of org.eclipse.swt.layout.RowLayout in project osate2 by osate.
the class FlowLatencyDialog method createDialogArea.
@Override
protected Control createDialogArea(final Composite parent) {
setHelpAvailable(true);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(), "org.osate.analysis.flows.flow_latency_dialog");
final Composite root = (Composite) super.createDialogArea(parent);
final ScrolledComposite scroller = new ScrolledComposite(root, SWT.H_SCROLL | SWT.V_SCROLL);
scroller.setLayoutData(new GridData(GridData.FILL_BOTH));
final Composite myWorkArea = new Composite(scroller, SWT.NONE);
scroller.setContent(myWorkArea);
myWorkArea.setLayout(new GridLayout(2, true));
createGroup(myWorkArea, "System type", Constants.ASYNCHRONOUS_SYSTEM_LAST_USED, new String[] { "Asynchronous system (AS)", "Synchronous system (SS)" }, new String[] { Constants.ASYNCHRONOUS_SYSTEM_YES, Constants.ASYNCHRONOUS_SYSTEM_NO });
createGroup(myWorkArea, "Partition output policy", Constants.PARTITONING_POLICY_LAST_USED, new String[] { "Partition end (PE)", "Major frame delayed (MF)" }, new String[] { Constants.PARTITIONING_POLICY_PARTITION_END_STR, Constants.PARTITIONING_POLICY_MAJOR_FRAME_DELAYED_STR });
createGroup(myWorkArea, "For worst-case processing time use", Constants.WORST_CASE_DEADLINE_LAST_USED, new String[] { "Deadline (DL)", "Maximum compute execution time (ET)" }, new String[] { Constants.WORST_CASE_DEADLINE_YES, Constants.WORST_CASE_DEADLINE_NO });
createGroup(myWorkArea, "For best-case queuing latency on incoming ports", Constants.BESTCASE_EMPTY_QUEUE_LAST_USED, new String[] { "Assume an empty queue (EQ)", "Assume a full queue (FQ)" }, new String[] { Constants.BESTCASE_EMPTY_QUEUE_YES, Constants.BESTCASE_EMPTY_QUEUE_NO });
createGroup(myWorkArea, "Disable queuing latency in the results", Constants.DISABLE_QUEUING_LATENCY_LAST_USED, new String[] { "Disable", "Enable" }, new String[] { Constants.DISABLE_QUEUING_LATENCY_YES, Constants.DISABLE_QUEUING_LATENCY_NO });
/*
* If we are showing the dialog, then the value of DONT_SHOW_DIALOG is false.
*/
dontShowDialog = false;
final Button hide = new Button(myWorkArea, SWT.CHECK);
hide.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
hide.setText("Don't show this dialog again");
hide.setToolTipText("Check this button to hide this dialog in the future. Use the" + System.lineSeparator() + "OSATE > Analysis > Flow Latency preference pane to bring it back.");
hide.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent event) {
dontShowDialog = hide.getSelection();
}
});
final Composite prefButtons = new Composite(myWorkArea, SWT.NONE);
prefButtons.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
prefButtons.setLayout(new RowLayout(SWT.HORIZONTAL));
final Button defaults = new Button(prefButtons, SWT.PUSH);
defaults.setText("Restore Defaults");
defaults.setToolTipText("Restore the setting above to the defaults from the " + System.lineSeparator() + "OSATE > Analysis > Flow Latency preference pane.");
defaults.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent event) {
/*
* Clear all selections first, then set them because setSelection()
* doesn't understand the other radio buttons in the same group.
*/
for (final String value : valueToButton.keySet()) {
valueToButton.get(value).setSelection(false);
}
for (int i = 0; i < PREF_IDS.length; i++) {
final String prefValue = latencyPrefs.getString(PREF_IDS[i]);
valueToButton.get(prefValue).setSelection(true);
localValues.put(LAST_USED_PREF_IDS[i], prefValue);
}
}
});
/*
* Don't bother having a "save preferences" button if the preferences aren't persistable
*/
if (latencyPrefs instanceof IPersistentPreferenceStore) {
final Button save = new Button(prefButtons, SWT.PUSH);
save.setText("Save as Defaults");
save.setToolTipText("Make the above settings the defaults as in the " + "\"OSATE > Analysis > Flow Latency\" preference pane.");
save.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent event) {
for (int i = 0; i < PREF_IDS.length; i++) {
latencyPrefs.setValue(PREF_IDS[i], localValues.get(LAST_USED_PREF_IDS[i]));
}
savePreferences();
}
});
}
myWorkArea.layout();
final Point workAreaSizeOriginal = myWorkArea.computeSize(SWT.DEFAULT, SWT.DEFAULT);
myWorkArea.setSize(workAreaSizeOriginal);
/*
* This is sleazy. We only need the scroller because on Windows and Linux (but not OS X it seems) fiddling
* with the system magnification/dpi/zoom settings can cause the contents of the window to be enlarged, but
* for some reason the bounds of the dialog remain sized at 100%. So we want to put out "work area" in
* the a scroller for this case. But we need to size the work area based on the size of the dialog so
* it doesn't look funny. Just using its computed size (see immediately above) is not sufficient, because
* it might be too narrow in the overall dialog and look strange. So we now wait for the scroller itself
* to be resized when the dialog/shell/window sets its initial size and then set the size of the
* "work area" to the minimum of its existing size and the new size. Then we can remove the listener.
*/
scroller.addControlListener(new ControlListener() {
@Override
public void controlResized(ControlEvent e) {
final Point newSize = scroller.getSize();
final int newWidth = workAreaSizeOriginal.x < newSize.x ? newSize.x : workAreaSizeOriginal.x;
final int newHeight = workAreaSizeOriginal.y < newSize.y ? newSize.y : workAreaSizeOriginal.y;
myWorkArea.setSize(new Point(newWidth, newHeight));
// Don't need the listener any more
scroller.removeControlListener(this);
}
@Override
public void controlMoved(ControlEvent e) {
// don't care
}
});
return root;
}
use of org.eclipse.swt.layout.RowLayout in project tracecompass by tracecompass.
the class HistogramView method createPartControl.
// ------------------------------------------------------------------------
// TmfView
// ------------------------------------------------------------------------
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
// Control labels
final String selectionStartLabel = Messages.HistogramView_selectionStartLabel;
final String selectionEndLabel = Messages.HistogramView_selectionEndLabel;
final String windowSpanLabel = Messages.HistogramView_windowSpanLabel;
// --------------------------------------------------------------------
// Set the HistogramView layout
// --------------------------------------------------------------------
Composite viewComposite = new Composite(getParentComposite(), SWT.FILL);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
viewComposite.setLayout(gridLayout);
// --------------------------------------------------------------------
// Add a sash for time controls and time range histogram
// --------------------------------------------------------------------
/*
* The ScrolledComposite preferred size can be larger than its visible
* width. This affects the preferred width of the SashForm. Set the
* preferred width to 1 to prevent it from affecting the preferred width
* of the view composite.
*/
fSashForm = new SashForm(viewComposite, SWT.NONE) {
@Override
public Point computeSize(int wHint, int hHint) {
Point computedSize = super.computeSize(wHint, hHint);
if (wHint == SWT.DEFAULT) {
return new Point(1, computedSize.y);
}
return computedSize;
}
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
Point computedSize = super.computeSize(wHint, hHint, changed);
if (wHint == SWT.DEFAULT) {
return new Point(1, computedSize.y);
}
return computedSize;
}
};
GridData gridData = new GridData(GridData.FILL, GridData.FILL, false, true);
fSashForm.setLayoutData(gridData);
// --------------------------------------------------------------------
// Time controls
// --------------------------------------------------------------------
fScrollComposite = new PackedScrolledComposite(fSashForm, SWT.H_SCROLL | SWT.V_SCROLL);
fTimeControlsComposite = new Composite(fScrollComposite, SWT.NONE);
fScrollComposite.setContent(fTimeControlsComposite);
gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
fScrollComposite.setLayout(gridLayout);
fScrollComposite.setExpandHorizontal(true);
fScrollComposite.setExpandVertical(true);
gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
fTimeControlsComposite.setLayout(gridLayout);
gridData = new GridData(GridData.FILL, GridData.CENTER, false, true);
fTimeControlsComposite.setLayoutData(gridData);
Composite innerComp = new Composite(fTimeControlsComposite, SWT.NONE);
gridLayout = new GridLayout(2, false);
innerComp.setLayout(gridLayout);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.horizontalSpacing = 5;
gridLayout.verticalSpacing = 1;
gridData = new GridData(GridData.FILL, GridData.CENTER, false, true);
innerComp.setLayoutData(gridData);
Composite selectionGroup = new Composite(innerComp, SWT.BORDER);
gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
selectionGroup.setLayout(gridLayout);
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
selectionGroup.setLayoutData(gridData);
// Selection start control
gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
fSelectionStartControl = new HistogramSelectionStartControl(this, selectionGroup, selectionStartLabel, 0L);
fSelectionStartControl.setLayoutData(gridData);
fSelectionStartControl.setValue(Long.MIN_VALUE);
// Selection end control
gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
fSelectionEndControl = new HistogramSelectionEndControl(this, selectionGroup, selectionEndLabel, 0L);
fSelectionEndControl.setLayoutData(gridData);
fSelectionEndControl.setValue(Long.MIN_VALUE);
// Link button
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
fLinkButton = new Label(innerComp, SWT.NONE);
fLinkButton.setImage(LINK_IMG);
fLinkButton.setLayoutData(gridData);
addLinkButtonListeners();
// Window span time control
gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
fTimeSpanControl = new HistogramTimeRangeControl(this, innerComp, windowSpanLabel, 0L);
fTimeSpanControl.setLayoutData(gridData);
fTimeSpanControl.setValue(Long.MIN_VALUE);
IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
// --------------------------------------------------------------------
// Time range histogram
// --------------------------------------------------------------------
fTimeRangeComposite = new Composite(fSashForm, SWT.NONE);
gridLayout = new GridLayout(1, true);
gridLayout.marginTop = 0;
gridLayout.marginWidth = 0;
fTimeRangeComposite.setLayout(gridLayout);
// Use remaining horizontal space
gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
fTimeRangeComposite.setLayoutData(gridData);
// Histogram
fTimeRangeHistogram = new TimeRangeHistogram(this, fTimeRangeComposite, true);
fTimeRangeHistogram.setStatusLineManager(statusLineManager);
// --------------------------------------------------------------------
// Full range histogram
// --------------------------------------------------------------------
final Composite fullRangeComposite = new Composite(viewComposite, SWT.FILL);
gridLayout = new GridLayout(1, true);
fullRangeComposite.setLayout(gridLayout);
// Use remaining horizontal space
gridData = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
fullRangeComposite.setLayoutData(gridData);
// Histogram
fFullTraceHistogram = new FullTraceHistogram(this, fullRangeComposite);
fFullTraceHistogram.setStatusLineManager(statusLineManager);
fLegendArea = new Composite(viewComposite, SWT.FILL);
fLegendArea.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 2, 1));
fLegendArea.setLayout(new RowLayout());
// Add mouse wheel listener to time span control
MouseWheelListener listener = fFullTraceHistogram.getZoom();
fTimeSpanControl.addMouseWheelListener(listener);
// View Action Handling
contributeToActionBars();
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
traceSelected(new TmfTraceSelectedSignal(this, trace));
}
fSashForm.setVisible(true);
fSashForm.setWeights(DEFAULT_WEIGHTS);
fTimeControlsComposite.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
// drag listener here
if (fSashDragListener == null) {
for (Control control : fSashForm.getChildren()) {
if (control instanceof Sash) {
fSashDragListener = event -> TmfSignalManager.dispatchSignal(new TmfTimeViewAlignmentSignal(fSashForm, getTimeViewAlignmentInfo()));
control.removePaintListener(this);
control.addListener(SWT.Selection, fSashDragListener);
// There should be only one sash
break;
}
}
}
}
});
}
use of org.eclipse.swt.layout.RowLayout in project tracecompass by tracecompass.
the class ViewFilterDialog method createCLabelsArea.
private static Composite createCLabelsArea(Composite container) {
Composite labels = new Composite(container, SWT.NONE);
GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
labels.setLayoutData(gd);
RowLayout rl = new RowLayout(SWT.HORIZONTAL);
rl.marginTop = 0;
rl.marginBottom = 0;
rl.marginLeft = 3;
rl.marginRight = 0;
labels.setLayout(rl);
return labels;
}
use of org.eclipse.swt.layout.RowLayout in project tracecompass by tracecompass.
the class AddBookmarkDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite areaComposite = (Composite) super.createDialogArea(parent);
Composite colorComposite = new Composite(areaComposite, SWT.NONE);
RowLayout layout = new RowLayout();
layout.center = true;
colorComposite.setLayout(layout);
colorComposite.moveBelow(getText());
Label colorLabel = new Label(colorComposite, SWT.NONE);
colorLabel.setText(Messages.AddBookmarkDialog_Color);
fColorSelector = new ColorSelector(colorComposite);
fColorSelector.setColorValue(new RGB(255, 0, 0));
Label alphaLabel = new Label(colorComposite, SWT.NONE);
alphaLabel.setText(Messages.AddBookmarkDialog_Alpha);
fAlphaScale = new Scale(colorComposite, SWT.NONE);
fAlphaScale.setMaximum(255);
fAlphaScale.setSelection(fAlpha);
fAlphaScale.setIncrement(1);
fAlphaScale.setPageIncrement(16);
fAlphaScale.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fAlpha = fAlphaScale.getSelection();
fAlphaLabel.setText(Integer.toString(fAlpha));
}
});
fAlphaLabel = new Label(colorComposite, SWT.NONE);
fAlphaLabel.setText(Integer.toString(fAlpha));
return areaComposite;
}
use of org.eclipse.swt.layout.RowLayout in project reddeer by eclipse.
the class SWTControlsView method createPartControl.
@Override
public void createPartControl(Composite composite) {
RowLayout rl = new RowLayout();
composite.setLayout(rl);
label = new Label(composite, SWT.NONE);
label.setText("Name:");
label.setData("org.eclipse.reddeer.widget.key", "label1");
text = new Text(composite, SWT.NONE);
text.setText("Original text");
text.setData("org.eclipse.reddeer.widget.key", "text1");
styledText = new StyledText(composite, SWT.NONE);
styledText.setText("Styled text");
styledText.setData("org.eclipse.reddeer.widget.key", "styledText1");
}
Aggregations