下面列出了org.eclipse.swt.widgets.Layout#org.eclipse.swt.layout.RowLayout 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void createOptionsArea(Composite composite) {
Composite radioArea = new Composite(composite, SWT.NONE);
RowLayout radioAreaLayout = new RowLayout(SWT.VERTICAL);
radioAreaLayout.marginLeft = 0;
radioAreaLayout.marginRight = 0;
radioAreaLayout.marginTop = 0;
radioAreaLayout.marginBottom = 0;
radioArea.setLayout(radioAreaLayout);
useTitleButton = createRadioButton(radioArea, Policy.bind("CommitSetDialog_2"));
enterCommentButton = createRadioButton(radioArea, Policy.bind("CommitSetDialog_3"));
SelectionAdapter listener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
updateEnablements();
}
};
useTitleButton.addSelectionListener(listener);
enterCommentButton.addSelectionListener(listener);
}
private void createAnimationGroup(Composite parent) {
Group animationGroup = createEmptyGroup(parent, "Animation");
animationGroup.setLayout(new RowLayout());
bAnimation = createButton(animationGroup, SWT.CHECK, "Animations", false, false);
bAnimation.addListener(SWT.Selection, groupParamSelectionListener);
cAnimationMovement = new Combo(animationGroup, SWT.READ_ONLY);
cAnimationMovement.setItems(new String[] { "ExpoOut", "BounceOut", "ElasticOut", "LinearInOut" });
cAnimationMovement.setText("ExpoOut");
cAnimationMovement.addListener(SWT.Selection, groupParamSelectionListener);
sAnimationDuration = new Spinner(animationGroup, SWT.NONE);
sAnimationDuration.setMinimum(250);
sAnimationDuration.setMaximum(5000);
sAnimationDuration.setIncrement(100);
sAnimationDuration.setSelection(500);
sAnimationDuration.addListener(SWT.Selection, groupParamSelectionListener);
}
private void createDecoratorsGroup(Composite parent) {
Group dataGroup = createEmptyGroup(parent, "Decorators");
dataGroup.setLayout(new RowLayout());
sDecoratorNumber = new Spinner(dataGroup, SWT.NONE);
sDecoratorNumber.setMinimum(1);
sDecoratorNumber.setMaximum(5);
sDecoratorNumber.setIncrement(1);
sDecoratorNumber.setSelection(1);
sDecoratorNumber.addListener(SWT.Selection, contentParamSelectionListener);
bDecoratorLeft = createButton(dataGroup, SWT.CHECK, "Top Left", false, false);
bDecoratorLeft.addListener(SWT.Selection, contentParamSelectionListener);
bDecoratorUp = createButton(dataGroup, SWT.CHECK, "Top Right", false, false);
bDecoratorUp.addListener(SWT.Selection, contentParamSelectionListener);
bDecoratorRight = createButton(dataGroup, SWT.CHECK, "Bottom Right", false, false);
bDecoratorRight.addListener(SWT.Selection, contentParamSelectionListener);
bDecoratorDown = createButton(dataGroup, SWT.CHECK, "Bottom Left", false, false);
bDecoratorDown.addListener(SWT.Selection, contentParamSelectionListener);
}
private void createItemParametersGroup(Composite parent) {
Group dataGroup = createEmptyGroup(parent, "Item parameters");
dataGroup.setLayout(new RowLayout());
cItemRenderer = new Combo(dataGroup, SWT.READ_ONLY);
cItemRenderer.setItems(new String[] { "Icon", "List" });
cItemRenderer.setText("Icon");
cItemRenderer.addListener(SWT.Selection, itemRendererParamSelectionListener);
bItemDropShadow = createButton(dataGroup, SWT.CHECK, "Drop shadow", false, true);
sItemDropShadowSize = new Spinner(dataGroup, SWT.NONE);
sItemDropShadowSize.setMinimum(0);
sItemDropShadowSize.setMaximum(20);
sItemDropShadowSize.setIncrement(1);
sItemDropShadowSize.setSelection(5);
sItemDropShadowSize.addListener(SWT.Selection, itemRendererParamSelectionListener);
bItemLabel = createButton(dataGroup, SWT.CHECK, "Display labels", false, true);
}
private void createStyleGroup(Composite parent) {
Group gp = new Group(parent, SWT.NONE);
gp.setText("Style");
gp.setLayout(new RowLayout());
GridData data = new GridData(SWT.FILL, SWT.FILL, false, false);
data.horizontalSpan = 2;
gp.setLayoutData(data);
borderStyle = new Button(gp, SWT.CHECK);
borderStyle.setText("SWT.BORDER");
borderStyle.addListener(SWT.Selection, recreateListener);
multiStyle = new Button(gp, SWT.CHECK);
multiStyle.setText("SWT.MULTI");
multiStyle.addListener(SWT.Selection, recreateListener);
}
private void createStyleGroup(Composite parent) {
Group gp = new Group(parent, SWT.NONE);
gp.setText("Style");
gp.setLayout(new RowLayout());
GridData data = new GridData(SWT.FILL, SWT.FILL, false, false);
// data.horizontalSpan = 2;
gp.setLayoutData(data);
borderStyle = new Button(gp, SWT.CHECK);
borderStyle.setText("SWT.BORDER");
borderStyle.addListener(SWT.Selection, recreateListener);
readOnlyStyle = new Button(gp, SWT.CHECK);
readOnlyStyle.setText("SWT.READ_ONLY");
readOnlyStyle.addListener(SWT.Selection, recreateListener);
flatStyle = new Button(gp, SWT.CHECK);
flatStyle.setText("SWT.FLAT");
flatStyle.addListener(SWT.Selection, recreateListener);
}
private void createHeader ( final Composite parent )
{
this.header = new Composite ( parent, SWT.NONE );
this.header.setLayoutData ( new GridData ( GridData.BEGINNING, GridData.BEGINNING, true, false ) );
this.header.setLayout ( new RowLayout () );
this.startButton = new Button ( this.header, SWT.TOGGLE );
this.startButton.setText ( Messages.getString ( "GeneratorView.ButtonGo" ) );
this.startButton.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
GeneratorView.this.toggleButton ( GeneratorView.this.startButton.getSelection () );
}
} );
this.errorLabel = new Label ( this.header, SWT.NONE );
}
public AssertionComposite ( final OrCondition orCondition, final Composite parent, final String attribute, final Type type )
{
// final fields
super ( parent, SWT.NONE );
this.orCondition = orCondition;
// widgets
this.notCheck = createNotCheck ();
this.attributeText = createAttributeText ( attribute );
createFieldTypeLabel ( type );
this.assertionCombo = createAssertionCombo ();
this.valueText = createValueText ();
createRemoveButton ();
// layout
final RowLayout layout = new RowLayout ();
layout.center = true;
this.setLayout ( layout );
parent.notifyListeners ( SWT.Resize, new org.eclipse.swt.widgets.Event () );
}
public LinkComposite ( final Composite parent, final int style, final String format )
{
super ( parent, style );
final RowLayout layout = new RowLayout ();
layout.wrap = false;
layout.center = true;
layout.spacing = 7;
layout.pack = true;
setLayout ( layout );
this.textLabel = new Link ( this, SWT.NONE );
this.textLabel.setText ( format );
this.textLabel.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent event )
{
logger.info ( "LinkComponent selected: {}", event.text ); //$NON-NLS-1$
Program.launch ( event.text );
}
} );
}
@Override
protected Control createContents(Composite parent) {
final Composite container = new Composite(parent, SWT.FILL);
container.setLayout(new GridLayout(1, true));
notifyBasicPreferenceListeners(container);
new Label(container, SWT.NONE);
final ExpandableComposite collap = new ExpandableComposite(container, SWT.Collapse);
collap.setText("Advanced Options");
final Composite advancedOptions = new Composite(collap, SWT.None);
collap.setClient(advancedOptions);
advancedOptions.setLayout(new RowLayout(SWT.VERTICAL));
notifyAdvancedPreferenceListeners(advancedOptions);
collap.setExpanded(true);
return container;
}
/**
* Creates a drawable tool tip instance.
*
* @param parent The parent composite.
*/
public DrawableToolTip(Composite parent) {
fToolTipShell = new Shell(parent.getShell(), SWT.ON_TOP);
fToolTipShell.setLayout(new RowLayout());
fToolTipShell.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
fToolTipShell.addPaintListener(this);
fToolTipShell.setSize(SHELL_WIDTH, SHELL_HEIGHT);
fToolTipShell.addDisposeListener((e) -> {
for (int i = 0; i < fColors.length; i++) {
fColors[i].dispose();
}
});
fColors = new Color[NUMBER_STEPS];
int greenBlue = BASE_GREEN_BLUE_VALUE;
final int step = COLOR_STEP;
for (int i = 0; i < fColors.length; i++) {
fColors[i] = new Color(Display.getDefault(), BASE_RED_VALUE, greenBlue, greenBlue);
greenBlue -= step;
}
}
/**
* Construct the {@code RangeTool} UI with the given set of options.
*
* @param parent containing window for range tool
* @param style basic presentation options
*/
public RangeTool(Composite parent, int style,
String label, RelationCount.RangeData setup) {
super(parent, style);
setLayout(new RowLayout());
Label rangeLabel = new Label(this, SWT.LEFT);
rangeLabel.setText(label);
rangeOp = createRangeOp(setup.option);
loLabel = new Label(this, SWT.LEFT);
loLimit = new Spinner(this, style);
hiLabel = new Label(this, SWT.LEFT);
hiLimit = new Spinner(this, style);
setLimits(setup);
}
public GenericResourceLoadControl(Composite parent, SaveLoadConfig<T> config) {
super(parent, SWT.NONE);
this.config = config;
setLayout(new RowLayout());
Button loadButton = new Button(this, SWT.PUSH);
loadButton.setText(config.getLoadLabel());
loadButton.setLayoutData(new RowData());
loadButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleLoad();
}
});
}
public GenericResourceSaveControl(Composite parent, SaveLoadConfig<T> config) {
super(parent, SWT.NONE);
this.config = config;
setLayout(new RowLayout());
Button saveButton = new Button(this, SWT.PUSH);
saveButton.setText(config.getSaveLabel());
saveButton.setLayoutData(new RowData());
saveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleSave();
}
});
}
/**
* Creates the checkbox buttons.
*
* @param parent the composite where to create them
*/
private void createCheckboxButtons(final Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new RowLayout(SWT.VERTICAL));
GridDataFactory.fillDefaults().span(2, 1).applyTo(composite);
final Button buttonShowCommandLineText = new Button(composite, SWT.CHECK);
buttonShowCommandLineText.setText("Show Command Line Text");
buttonShowCommandLineText.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
final boolean selection = buttonShowCommandLineText.getSelection();
commandLineText.getParent().setVisible(selection);
((GridData) commandLineText.getParent().getLayoutData()).exclude = !selection;
final Point size = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
getShell().setSize(size);
getShell().layout(true, true);
}
});
buttonConfirmCommit = new Button(composite, SWT.CHECK);
RowDataFactory.swtDefaults().exclude(true).applyTo(buttonConfirmCommit);
buttonConfirmCommit.setText("Confirm 'Commit'. Repository contained changes before merge.");
buttonConfirmCommit.setForeground(buttonConfirmCommit.getDisplay().getSystemColor(SWT.COLOR_RED));
buttonConfirmCommit.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
commitButton.setEnabled(buttonConfirmCommit.getSelection());
}
});
}
/**
* {@inheritDoc}
*/
@Override
protected Control createDialogArea(Composite parent) {
final Composite dialogComposite = (Composite) super.createDialogArea(parent);
final Composite composite = new Composite(dialogComposite, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
composite.setLayout(new GridLayout(2, false));
if (StringUtils.isNotEmpty(mergeFrom) && StringUtils.isNotEmpty(mergeTo)) {
final Composite compMergeFromTo = new Composite(composite, SWT.NONE);
compMergeFromTo.setLayout(new RowLayout(SWT.HORIZONTAL));
compMergeFromTo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
new Label(compMergeFromTo, SWT.NONE).setText(Messages.DirectorySelectionDialog_mergeFrom);
final Label labelFrom = new Label(compMergeFromTo, SWT.NONE);
labelFrom.setFont(JFaceResources.getFontRegistry().getBold(""));
labelFrom.setText(mergeFrom);
new Label(compMergeFromTo, SWT.NONE).setText(Messages.DirectorySelectionDialog_mergeTo);
final Label labelTo = new Label(compMergeFromTo, SWT.NONE);
labelTo.setFont(JFaceResources.getFontRegistry().getBold(""));
labelTo.setText(mergeTo);
}
textRepository = new Text(composite, SWT.BORDER);
textRepository.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
if (selectedPath != null) {
textRepository.setText(selectedPath.toString());
}
textRepository.addModifyListener(e -> setErrorMessage(null));
final Button buttonBrowseRepository = new Button(composite, SWT.NONE);
buttonBrowseRepository.setText(Messages.DirectorySelectionDialog_browse);
buttonBrowseRepository.addListener(SWT.Selection, e -> openDirectoryDialog());
return dialogComposite;
}
public WeaponEffectSelectionView(Composite parent, int style, GameType type) {
super(parent, style);
RowLayout rowLayout = new RowLayout();
rowLayout.pack = false;
setLayout(rowLayout);
buildView(type);
}
private void createStyleGroup(Composite parent) {
Group styleGroup = createEmptyGroup(parent, "Style");
styleGroup.setLayout(new RowLayout());
bMulti = createButton(styleGroup, SWT.CHECK, "SWT.MULTI", false, true);
bVScroll = createButton(styleGroup, SWT.RADIO, "SWT.V_SCROLL", true, true);
bHScroll = createButton(styleGroup, SWT.RADIO, "SWT.H_SCROLL", false, true);
}
private void createDataGroup(Composite parent) {
Group dataGroup = createEmptyGroup(parent, "Data");
dataGroup.setLayout(new RowLayout());
bGroupImage = createButton(dataGroup, SWT.CHECK, "Group image", false, true);
bGroupDescription = createButton(dataGroup, SWT.CHECK, "Group descriptions", false, true);
bItemDescription = createButton(dataGroup, SWT.CHECK, "Item descriptions", false, true);
}
public Control createControl(Composite parent) {
Composite c = new Composite(parent, SWT.None);
c.setLayout(new RowLayout());
Button b = new Button(c, SWT.None);
b.setText("Fade");
b.addListener(SWT.Selection, e -> {
Shell s = new Shell(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.CLOSE | SWT.TITLE);
s.setAlpha(0);
s.open();
AnimationRunner runner = new AnimationRunner();
runner.runEffect(new AlphaEffect(s, 0, 255, 1000, new ExpoOut(), null, null));
AlphaEffect.fadeOnClose(s, 1000, new ExpoOut(), runner);
});
return c;
}
public void createControls(Composite parent) {
parent.setLayout(new GridLayout(2, true));
final RichTextEditor editor = new RichTextEditor(parent);
GridDataFactory.fillDefaults().grab(true, true).applyTo(editor);
final RichTextViewer viewer = new RichTextViewer(parent, SWT.BORDER | SWT.WRAP);
viewer.setWordSplitRegex("\\s|\\-");//wrap after whitespace characters and delimiter
GridDataFactory.fillDefaults().grab(true, true).span(1, 2).applyTo(viewer);
final Text htmlOutput = new Text(parent,
SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).hint(SWT.DEFAULT, 100).applyTo(htmlOutput);
Composite buttonPanel = new Composite(parent, SWT.NONE);
buttonPanel.setLayout(new RowLayout());
GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonPanel);
Button getButton = new Button(buttonPanel, SWT.PUSH);
getButton.setText("Get text");
getButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String htmlText = editor.getText();
viewer.setText(htmlText);
htmlOutput.setText(htmlText);
}
});
}
public Control createControl(Composite parent) {
Composite shell = new Composite(parent, SWT.None);
final PrintJob job = new PrintJob("GridPrintVerticalAlignmentExample.java", createPrint());
shell.setLayout(new org.eclipse.swt.layout.GridLayout());
Composite buttonPanel = new Composite(shell, SWT.NONE);
buttonPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
buttonPanel.setLayout(new RowLayout(SWT.HORIZONTAL));
final PrintPreview preview = new PrintPreview(shell, SWT.BORDER);
Button prev = new Button(buttonPanel, SWT.PUSH);
prev.setText("<< Prev");
prev.addListener(SWT.Selection, event -> {
preview.setPageIndex(Math.max(preview.getPageIndex() - 1, 0));
});
Button next = new Button(buttonPanel, SWT.PUSH);
next.setText("Next >>");
next.addListener(SWT.Selection, event -> {
preview.setPageIndex(Math.min(preview.getPageIndex() + 1, preview.getPageCount() - 1));
});
Button print = new Button(buttonPanel, SWT.PUSH);
print.setText("Print");
print.addListener(SWT.Selection, event -> {
PaperClips.print(job, new PrinterData());
});
preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
preview.setFitHorizontal(true);
preview.setFitVertical(true);
preview.setPrintJob(job);
return shell;
}
public static void main( String args[] )
{
display = Display.getDefault( );
Shell shell = new Shell( display );
shell.setSize( 220, 80 );
shell.setLocation( display.getClientArea( ).width / 2 - 110, display
.getClientArea( ).height / 2 - 40 );
shell.setLayout( new GridLayout( ) );
Regression_136069_svg siv = new Regression_136069_svg( shell, SWT.NONE );
GridData gd = new GridData( GridData.BEGINNING );
gd.widthHint = 1;
gd.heightHint = 1;
siv.setLayoutData( gd );
Composite cBottom = new Composite( shell, SWT.NONE );
cBottom.setLayoutData( new GridData( GridData.CENTER ) );
cBottom.setLayout( new RowLayout( ) );
Label la = new Label( cBottom, SWT.NONE );
la.setText( "Choose: " );//$NON-NLS-1$
cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
cbType.add( "UrlRedirect" );//$NON-NLS-1$
cbType.select( 0 );
btn = new Button( cBottom, SWT.NONE );
btn.setText( "Show" );//$NON-NLS-1$
btn.addSelectionListener( siv );
shell.open( );
while ( !shell.isDisposed( ) )
{
if ( !display.readAndDispatch( ) )
display.sleep( );
}
display.dispose( );
}
/**
* Constructs a new instance of this class given its parent and a style value
* describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in class
* <code>SWT</code> which is applicable to instances of this class, or must be
* built by <em>bitwise OR</em>'ing together (that is, using the
* <code>int</code> "|" operator) two or more of those <code>SWT</code> style
* constants. The class description lists the style constants that are
* applicable to the class. Style bits are also inherited from superclasses.
* </p>
*
* @param parent a widget which will be the parent of the new instance (cannot
* be null)
* @param style the style of widget to construct
*
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException
* <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
* thread that created the parent</li>
* </ul>
*
* @see Composite#Composite(Composite, int)
* @see SWT#BORDER
* @see Widget#getStyle
*/
public ColumnBrowserWidget(final Composite parent, final int style) {
super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL);
composite = new Composite(this, SWT.NONE);
final RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.spacing = 1;
layout.pack = false;
composite.setLayout(layout);
columnArrow = SWTGraphicUtil.createImageFromFile("images/columnArrow.png");
columns = new ArrayList<Table>();
for (int i = 0; i < 3; i++) {
createTable();
}
// Store root
columns.get(0).setData(new ColumnItem(this));
setContent(composite);
setExpandHorizontal(true);
setExpandVertical(true);
setShowFocusedControl(true);
updateContent();
this.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
selectionListeners = new ArrayList<SelectionListener>();
addDisposeListener(e -> {
SWTGraphicUtil.safeDispose(columnArrow);
});
}
private Composite createFooter ( final Composite parent )
{
final Composite footer = new Composite ( parent, SWT.NONE );
footer.setLayout ( new RowLayout () );
footer.setData ( RWT.CUSTOM_VARIANT, "footer" );
footer.setBackgroundMode ( SWT.INHERIT_DEFAULT );
final Label label = new Label ( footer, SWT.NONE );
label.setText ( System.getProperty ( Properties.FOOTER_TEXT, "Eclipse SCADA Admin Console" ) );
return footer;
}
private void createAllEntries ()
{
final Composite extensionSpace = this.extensionSpaceProvider.getExtensionSpace ();
if ( extensionSpace == null )
{
return;
}
this.wrapper = new Composite ( extensionSpace, SWT.NONE );
final RowLayout layout = new RowLayout ( SWT.HORIZONTAL );
layout.marginTop = layout.marginBottom = 0;
this.wrapper.setLayout ( layout );
int i = 0;
for ( final Profile profile : this.profiles )
{
final ProfileEntry entry = createProfileEntry ( profile, i );
if ( entry != null )
{
this.profileEntries.put ( profile.getId (), entry );
}
i++;
}
final Label sep = new Label ( this.wrapper, SWT.SEPARATOR | SWT.VERTICAL );
sep.setLayoutData ( new RowData ( SWT.DEFAULT, 20 ) );
extensionSpace.layout ();
}
protected void createView ( final Chart configuration )
{
final Composite extensionSpace = new Composite ( this.wrapper, SWT.NONE );
extensionSpace.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
extensionSpace.setLayout ( new RowLayout ( SWT.HORIZONTAL ) );
this.chartArea = new ChartArea ( this.wrapper, SWT.NONE );
this.chartArea.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );
this.viewer = new ChartViewer ( this.chartArea.getDisplay (), this.chartArea.getChartRenderer (), configuration, new CompositeExtensionSpace ( extensionSpace ), null );
getSite ().setSelectionProvider ( this.viewer );
getSite ().getWorkbenchWindow ().getSelectionService ().addPostSelectionListener ( new ISelectionListener () {
@Override
public void selectionChanged ( final IWorkbenchPart part, final ISelection selection )
{
final ChartInput sel = SelectionHelper.first ( selection, ChartInput.class );
if ( sel == null )
{
AbstractChartView.this.viewer.setSelection ( (ChartInput)null );
}
else
{
AbstractChartView.this.viewer.setSelection ( sel );
}
// else: don't select anything which we do not care about
}
} );
}
public AddAssertionComposite ( final OrCondition orCondition, final Composite parent )
{
// fields
super ( parent, SWT.NONE );
this.orCondition = orCondition;
// widgets
this.attributeCombo = createAttributeCombo ();
createTypeCombo ();
createAddButton ();
// layout
final RowLayout layout = new RowLayout ();
this.setLayout ( layout );
}
private Combo makeCombo(Composite parent, String labelText, java.util.List<?> options) {
Composite group = new Composite(parent, SWT.NONE);
group.setLayout(new RowLayout(SWT.HORIZONTAL));
Label label = new Label(group, SWT.NONE);
label.setText(labelText + ": ");
Combo combo = new Combo(group, SWT.READ_ONLY);
String[] items = new String[options.size()];
for (int i = 0; i < items.length; i++) {
items[i] = options.get(i).toString();
}
combo.setItems(items);
return combo;
}
@Override
protected void activateView ()
{
if ( this.chart != null )
{
return;
}
this.wrapper = new SashForm ( this.viewHolder, SWT.HORIZONTAL );
this.wrapper.setLayout ( new FillLayout ( SWT.HORIZONTAL ) );
final Composite subWrapper = new Composite ( this.wrapper, SWT.NONE );
subWrapper.setLayout ( GridLayoutFactory.slimStack () );
final Composite extensionSpace = new Composite ( subWrapper, SWT.NONE );
extensionSpace.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, false ) );
extensionSpace.setLayout ( new RowLayout ( SWT.HORIZONTAL ) );
this.chartArea = new ChartArea ( subWrapper, SWT.NONE );
this.chartArea.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );
this.configuration = ChartHelper.loadConfiguraton ( this.descriptor.getUri ().toString () );
this.chart = new ChartViewer ( this.chartArea.getDisplay (), this.chartArea.getChartRenderer (), this.configuration, new CompositeExtensionSpace ( extensionSpace ), new ResetHandler () {
@Override
public void reset ()
{
reload ();
}
} );
if ( this.showSelector )
{
this.selector = new ChartInputSelector ( this.wrapper, this.chart, true );
this.wrapper.setWeights ( new int[] { 85, 15 } );
}
this.viewManagerContext.setSelectionProvider ( this.chart );
this.chart.setFocus ();
}