List of usage examples for org.eclipse.jface.viewers TableViewer getControl
@Override
public Control getControl()
From source file:phasereditor.assetpack.ui.AssetPackUI.java
License:Open Source License
public static void installAssetTooltips(TableViewer viewer) { List<ICustomInformationControlCreator> creators = getInformationControlCreatorsForTooltips(); Tooltips.install(viewer.getControl(), new TableViewerInformationProvider(viewer), creators, false); }
From source file:sernet.verinice.rcp.account.ProfilePage.java
License:Open Source License
private TableViewer createTable(Composite parent, String title) { Label label = new Label(parent, SWT.WRAP); label.setText(title);//from w w w . j a v a 2s. com label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); TableViewer table0 = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); table0.getControl().setLayoutData(gd); table0.setUseHashlookup(true); return table0; }
From source file:sernet.verinice.rcp.unify.UnifyPageMapping.java
License:Open Source License
private TableViewer createTable(Composite parent) { final int defaultColumnWeight = 50; Composite tableComposite = new Composite(parent, SWT.Resize); GridData tGd = new GridData(SWT.FILL, SWT.FILL, true, true); tGd.minimumHeight = 87;//from w ww. j a va 2 s . c o m tableComposite.setLayoutData(tGd); TableColumnLayout tableColumnLayout = new TableColumnLayout(); tableComposite.setLayout(tableColumnLayout); TableViewer tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI); Table internalTable = tableViewer.getTable(); // Spaltenkpfe und Zeilenbegrenzungen sichtbar machen internalTable.setHeaderVisible(true); internalTable.setLinesVisible(true); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); tableViewer.getControl().setLayoutData(gd); tableViewer.setUseHashlookup(true); TableViewerColumn sourceColumn = new TableViewerColumn(tableViewer, SWT.NONE); sourceColumn.getColumn().setText(Messages.UnifyPageMapping_5); sourceColumn.setLabelProvider(new CellLabelProvider() { @Override public void update(ViewerCell cell) { UnifyMapping mapping = (UnifyMapping) cell.getElement(); String sourceTitle = mapping.getSourceElement().getTitle(); if (sourceTitle != null) { cell.setText(sourceTitle); } setCellColor(cell, mapping); } }); tableColumnLayout.setColumnData(sourceColumn.getColumn(), new ColumnWeightData(defaultColumnWeight)); TableViewerColumn destinationColumn = new TableViewerColumn(tableViewer, SWT.NONE); destinationColumn.getColumn().setText(Messages.UnifyPageMapping_6); destinationColumn.setLabelProvider(new CellLabelProvider() { @Override public void update(ViewerCell cell) { UnifyMapping mapping = (UnifyMapping) cell.getElement(); cell.setText(mapping.getDestinationText()); setCellColor(cell, mapping); } }); tableColumnLayout.setColumnData(destinationColumn.getColumn(), new ColumnWeightData(defaultColumnWeight)); return tableViewer; }
From source file:sernet.verinice.rcp.unify.UnifyPageSelectGroup.java
License:Open Source License
private TableViewer createTable(Composite parent, String title) { Label label = new Label(parent, SWT.WRAP); label.setText(title);// w w w . j a va 2s. com label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL; TableViewer table = new TableViewer(parent, style | SWT.MULTI); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); table.getControl().setLayoutData(gd); table.setUseHashlookup(true); return table; }
From source file:sernet.verinice.rcp.UserprofileDialog.java
License:Open Source License
private TableViewer createTable(Composite parent, String title) { Label label = new Label(parent, SWT.WRAP); label.setText(title);/* w w w . j a va 2 s . com*/ label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL; TableViewer internalTable = new TableViewer(parent, style | SWT.MULTI); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); internalTable.getControl().setLayoutData(gd); internalTable.setUseHashlookup(true); return internalTable; }
From source file:skillpro.dialogs.AddRequirementPairDialog.java
License:Open Source License
private void createPreRequirementComposite(Composite parent) { GridDataFactory gdGrab = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).copy().grab(true, false);/*from w w w .ja va 2s . c o m*/ Composite preRequirementComposite = new Composite(parent, SWT.NONE); preRequirementComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(1, 1).create()); preRequirementComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); //center label Label preRequirementLabel = new Label(preRequirementComposite, SWT.NONE); preRequirementLabel.setText("Pre-Requirement"); preRequirementLabel.setLayoutData( GridDataFactory.fillDefaults().span(2, 1).align(SWT.CENTER, SWT.CENTER).grab(true, false).create()); //ResourceConfigurationType Label resourceConfigTypeLabel = new Label(preRequirementComposite, SWT.NONE); resourceConfigTypeLabel.setText("Resource Config Type"); resourceConfigTypeLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final ComboViewer resourceConfigTypeCV = new ComboViewer(preRequirementComposite); resourceConfigTypeCV.getControl().setLayoutData(gdGrab.create()); resourceConfigTypeCV.setContentProvider(new ArrayContentProvider()); resourceConfigTypeCV.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((RequirementResourceConfigType) element).toString(); } }); List<RequirementResourceConfigType> resourceConfigurationTypeInput = Arrays .asList(RequirementResourceConfigType.values()); resourceConfigurationTypeInput = new ArrayList<>(resourceConfigurationTypeInput); for (Iterator<RequirementResourceConfigType> iter = resourceConfigurationTypeInput.iterator(); iter .hasNext();) { RequirementResourceConfigType type = iter.next(); if (type.toString().equalsIgnoreCase("different_any") || type.toString().equalsIgnoreCase("same")) { iter.remove(); } } resourceConfigTypeCV.setInput(resourceConfigurationTypeInput); if (preResourceConfigType != null) { resourceConfigTypeCV.setSelection(new StructuredSelection(preResourceConfigType)); } else if (resourceConfigurationTypeInput.size() > 0) { resourceConfigTypeCV.setSelection(new StructuredSelection(resourceConfigurationTypeInput.get(0))); preResourceConfigType = resourceConfigurationTypeInput.get(0); } //ResourceConfiguration Label resourceConfigurationLabel = new Label(preRequirementComposite, SWT.NONE); resourceConfigurationLabel.setText("Resource Configuration"); resourceConfigurationLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); preResourceConfigCV = new ComboViewer(preRequirementComposite); preResourceConfigCV.getControl().setLayoutData(gdGrab.create()); preResourceConfigCV.setContentProvider(new ArrayContentProvider()); preResourceConfigCV.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((ResourceConfiguration) element).getName(); } }); List<ResourceConfiguration> resourceConfigInput = requiredResourceSkill != null ? new ArrayList<>(requiredResourceSkill.getResource().getResourceConfigurations()) : new ArrayList<ResourceConfiguration>(); preResourceConfigCV.setInput(resourceConfigInput); if (preResourceConfiguration != null) { preResourceConfigCV.setSelection(new StructuredSelection(preResourceConfiguration)); } else if (resourceConfigInput.size() > 0) { preResourceConfigCV.setSelection(new StructuredSelection(resourceConfigInput.get(0))); preResourceConfiguration = resourceConfigInput.get(0); } if (preResourceConfigType != RequirementResourceConfigType.SPECIFIC) { preResourceConfigCV.getControl().setEnabled(false); } //ProductConfigurationType Label productConfigurationTypeLabel = new Label(preRequirementComposite, SWT.NONE); productConfigurationTypeLabel.setText("Product Config Type"); productConfigurationTypeLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final ComboViewer productConfigTypeCV = new ComboViewer(preRequirementComposite); productConfigTypeCV.getControl().setLayoutData(gdGrab.create()); productConfigTypeCV.setContentProvider(new ArrayContentProvider()); productConfigTypeCV.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((RequirementProductConfigType) element).toString(); } }); List<RequirementProductConfigType> productConfigTypeInput = Arrays .asList(RequirementProductConfigType.values()); productConfigTypeInput = new ArrayList<>(productConfigTypeInput); for (Iterator<RequirementProductConfigType> iter = productConfigTypeInput.iterator(); iter.hasNext();) { RequirementProductConfigType type = iter.next(); if (type.toString().equalsIgnoreCase("same")) { iter.remove(); } } productConfigTypeCV.setInput(productConfigTypeInput); if (preProductConfigType != null) { productConfigTypeCV.setSelection(new StructuredSelection(preProductConfigType)); } else if (productConfigTypeInput.size() > 0) { productConfigTypeCV.setSelection(new StructuredSelection(productConfigTypeInput.get(0))); preProductConfigType = productConfigTypeInput.get(0); } //ProductConfiguration Label ProductConfigurationLabel = new Label(preRequirementComposite, SWT.NONE); ProductConfigurationLabel.setText("Product Configuration"); ProductConfigurationLabel .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); String[] headers = { "Name", "Quantity" }; int[] bounds = { 100, 100 }; // input if (preProductConfiguration != null) { preProductQuantities.addAll(preProductConfiguration.getProductQuantities()); } final TableViewer preProductQuantitiesTableViewer = createTableViewer(preRequirementComposite, headers, bounds); preProductQuantitiesTableViewer.setInput(preProductQuantities); preProductQuantitiesTableViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).hint(0, 200).create()); // ADD Buttons Composite inputButtonsArea = new Composite(preRequirementComposite, SWT.NONE); inputButtonsArea.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); Button addPreProductQuantityButton = new Button(inputButtonsArea, SWT.PUSH); addPreProductQuantityButton.setText("Add"); Button deleteProductQuantityButton = new Button(inputButtonsArea, SWT.PUSH); deleteProductQuantityButton.setText("Delete"); if (preProductConfigType != RequirementProductConfigType.SPECIFIC) { preProductQuantitiesTableViewer.getControl().setEnabled(false); } //Listeners!! resourceConfigTypeCV.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { preResourceConfigType = (RequirementResourceConfigType) ((IStructuredSelection) resourceConfigTypeCV .getSelection()).getFirstElement(); if (preResourceConfigType == RequirementResourceConfigType.SPECIFIC) { preResourceConfigCV.getControl().setEnabled(true); preResourceConfiguration = (ResourceConfiguration) ((IStructuredSelection) preResourceConfigCV .getSelection()).getFirstElement(); } else { preResourceConfigCV.getControl().setEnabled(false); preResourceConfiguration = null; } validate(); } }); preResourceConfigCV.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { preResourceConfiguration = (ResourceConfiguration) ((IStructuredSelection) preResourceConfigCV .getSelection()).getFirstElement(); validate(); } }); productConfigTypeCV.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { preProductConfigType = (RequirementProductConfigType) ((IStructuredSelection) productConfigTypeCV .getSelection()).getFirstElement(); if (preProductConfigType == RequirementProductConfigType.SPECIFIC) { preProductQuantitiesTableViewer.getControl().setEnabled(true); } else { preProductQuantitiesTableViewer.getControl().setEnabled(false); } validate(); } }); addPreProductQuantityButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AddInputOutputDialog dialog = new AddInputOutputDialog(getShell(), ProductDialogType.INPUT_DIALOG, preProductQuantities); if (dialog.open() == Window.OK) { for (ProductQuantity pq : dialog.getResult()) { preProductQuantities.add(pq); } preProductQuantitiesTableViewer.refresh(); validate(); } } }); deleteProductQuantityButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { deleteSelected(preProductQuantitiesTableViewer); preProductQuantitiesTableViewer.refresh(); validate(); } }); }
From source file:skillpro.dialogs.AddRequirementPairDialog.java
License:Open Source License
private void createPostRequirementComposite(Composite parent) { GridDataFactory gdGrab = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).copy().grab(true, false);/*from w w w. ja v a 2s. c om*/ Composite postRequirementComposite = new Composite(parent, SWT.NONE); postRequirementComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(1, 1).create()); postRequirementComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); //center label Label postRequirementLabel = new Label(postRequirementComposite, SWT.NONE); postRequirementLabel.setText("Post-Requirement"); postRequirementLabel.setLayoutData( GridDataFactory.fillDefaults().span(2, 1).align(SWT.CENTER, SWT.CENTER).grab(true, false).create()); //ResourceConfigurationType Label resourceConfigTypeLabel = new Label(postRequirementComposite, SWT.NONE); resourceConfigTypeLabel.setText("Resource Config Type"); resourceConfigTypeLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final ComboViewer resourceConfigTypeCV = new ComboViewer(postRequirementComposite); resourceConfigTypeCV.getControl().setLayoutData(gdGrab.create()); resourceConfigTypeCV.setContentProvider(new ArrayContentProvider()); resourceConfigTypeCV.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((RequirementResourceConfigType) element).toString(); } }); List<RequirementResourceConfigType> resourceConfigurationTypeInput = Arrays .asList(RequirementResourceConfigType.values()); resourceConfigTypeCV.setInput(resourceConfigurationTypeInput); if (postResourceConfigType != null) { resourceConfigTypeCV.setSelection(new StructuredSelection(postResourceConfigType)); } else if (resourceConfigurationTypeInput.size() > 0) { resourceConfigTypeCV.setSelection(new StructuredSelection(resourceConfigurationTypeInput.get(0))); postResourceConfigType = resourceConfigurationTypeInput.get(0); } //ResourceConfiguration Label resourceConfigurationLabel = new Label(postRequirementComposite, SWT.NONE); resourceConfigurationLabel.setText("Resource Configuration"); resourceConfigurationLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); postResourceConfigCV = new ComboViewer(postRequirementComposite); postResourceConfigCV.getControl().setLayoutData(gdGrab.create()); postResourceConfigCV.setContentProvider(new ArrayContentProvider()); postResourceConfigCV.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((ResourceConfiguration) element).getName(); } }); List<ResourceConfiguration> resourceConfigInput = requiredResourceSkill != null ? new ArrayList<>(requiredResourceSkill.getResource().getResourceConfigurations()) : new ArrayList<ResourceConfiguration>(); postResourceConfigCV.setInput(resourceConfigInput); if (postResourceConfiguration != null) { postResourceConfigCV.setSelection(new StructuredSelection(postResourceConfiguration)); } else if (resourceConfigInput.size() > 0) { postResourceConfigCV.setSelection(new StructuredSelection(resourceConfigInput.get(0))); postResourceConfiguration = resourceConfigInput.get(0); } if (postResourceConfigType != RequirementResourceConfigType.SPECIFIC) { postResourceConfigCV.getControl().setEnabled(false); } //ProductConfigurationType Label productConfigurationTypeLabel = new Label(postRequirementComposite, SWT.NONE); productConfigurationTypeLabel.setText("Product Config Type"); productConfigurationTypeLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final ComboViewer productConfigTypeCV = new ComboViewer(postRequirementComposite); productConfigTypeCV.getControl().setLayoutData(gdGrab.create()); productConfigTypeCV.setContentProvider(new ArrayContentProvider()); productConfigTypeCV.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((RequirementProductConfigType) element).toString(); } }); List<RequirementProductConfigType> productConfigTypeInput = Arrays .asList(RequirementProductConfigType.values()); productConfigTypeInput = new ArrayList<>(productConfigTypeInput); for (Iterator<RequirementProductConfigType> iter = productConfigTypeInput.iterator(); iter.hasNext();) { RequirementProductConfigType type = iter.next(); if (type.toString().equalsIgnoreCase("any")) { iter.remove(); } } productConfigTypeCV.setInput(productConfigTypeInput); if (postProductConfigType != null) { productConfigTypeCV.setSelection(new StructuredSelection(postProductConfigType)); } else if (productConfigTypeInput.size() > 0) { productConfigTypeCV.setSelection(new StructuredSelection(productConfigTypeInput.get(0))); postProductConfigType = productConfigTypeInput.get(0); } //ProductConfiguration Label ProductConfigurationLabel = new Label(postRequirementComposite, SWT.NONE); ProductConfigurationLabel.setText("Product Configuration"); ProductConfigurationLabel .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); String[] headers = { "Name", "Quantity" }; int[] bounds = { 100, 100 }; // input if (postProductConfiguration != null) { postProductQuantities.addAll(postProductConfiguration.getProductQuantities()); } final TableViewer postProductQuantitiesTableViewer = createTableViewer(postRequirementComposite, headers, bounds); postProductQuantitiesTableViewer.setInput(postProductQuantities); postProductQuantitiesTableViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).hint(0, 200).create()); // ADD Buttons Composite inputButtonsArea = new Composite(postRequirementComposite, SWT.NONE); inputButtonsArea.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); final Button addPostProductQuantityButton = new Button(inputButtonsArea, SWT.PUSH); addPostProductQuantityButton.setText("Add"); final Button deletePostProductQuantityButton = new Button(inputButtonsArea, SWT.PUSH); deletePostProductQuantityButton.setText("Delete"); if (postProductConfigType != RequirementProductConfigType.SPECIFIC) { postProductQuantitiesTableViewer.getControl().setEnabled(false); } //Listeners!! resourceConfigTypeCV.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { postResourceConfigType = (RequirementResourceConfigType) ((IStructuredSelection) resourceConfigTypeCV .getSelection()).getFirstElement(); if (postResourceConfigType == RequirementResourceConfigType.SPECIFIC) { postResourceConfigCV.getControl().setEnabled(true); postResourceConfiguration = (ResourceConfiguration) ((IStructuredSelection) postResourceConfigCV .getSelection()).getFirstElement(); } else { if (postResourceConfigType == RequirementResourceConfigType.SAME) { if (preResourceConfiguration != null) { postResourceConfigCV.setSelection(new StructuredSelection(preResourceConfiguration)); } } postResourceConfiguration = null; postResourceConfigCV.getControl().setEnabled(false); } validate(); } }); postResourceConfigCV.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { postResourceConfiguration = (ResourceConfiguration) ((IStructuredSelection) postResourceConfigCV .getSelection()).getFirstElement(); validate(); } }); productConfigTypeCV.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { postProductConfigType = (RequirementProductConfigType) ((IStructuredSelection) productConfigTypeCV .getSelection()).getFirstElement(); if (postProductConfigType == RequirementProductConfigType.SPECIFIC) { postProductQuantitiesTableViewer.getControl().setEnabled(true); } else { postProductQuantitiesTableViewer.getControl().setEnabled(false); } validate(); } }); addPostProductQuantityButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AddInputOutputDialog dialog = new AddInputOutputDialog(getShell(), ProductDialogType.INPUT_DIALOG, postProductQuantities); if (dialog.open() == Window.OK) { for (ProductQuantity pq : dialog.getResult()) { postProductQuantities.add(pq); } postProductQuantitiesTableViewer.refresh(); validate(); } } }); deletePostProductQuantityButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { deleteSelected(postProductQuantitiesTableViewer); postProductQuantitiesTableViewer.refresh(); validate(); } }); }
From source file:skillpro.dialogs.ProductConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); container.setLayout(GridLayoutFactory.fillDefaults().margins(5, 5).equalWidth(false).create()); Label ProductConfigurationLabel = new Label(container, SWT.NONE); ProductConfigurationLabel.setText("Product Configuration"); ProductConfigurationLabel/*ww w.j a v a2 s . co m*/ .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); String[] headers = { "Name", "Quantity" }; int[] bounds = { 100, 100 }; // input final TableViewer preProductQuantitiesTableViewer = createTableViewer(container, headers, bounds); preProductQuantitiesTableViewer.setInput(inputs); preProductQuantitiesTableViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, true).hint(0, 200).create()); // ADD Buttons Composite inputButtonsArea = new Composite(container, SWT.NONE); inputButtonsArea.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create()); Button addPreProductQuantityButton = new Button(inputButtonsArea, SWT.PUSH); addPreProductQuantityButton.setText("Add"); Button deleteProductQuantityButton = new Button(inputButtonsArea, SWT.PUSH); deleteProductQuantityButton.setText("Delete"); addPreProductQuantityButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { AddInputOutputDialog dialog = new AddInputOutputDialog(getShell(), ProductDialogType.INPUT_DIALOG, inputs); if (dialog.open() == Window.OK) { for (ProductQuantity pq : dialog.getResult()) { inputs.add(pq); } preProductQuantitiesTableViewer.refresh(); } } }); deleteProductQuantityButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { deleteSelected(preProductQuantitiesTableViewer); preProductQuantitiesTableViewer.refresh(); } }); return area; }
From source file:tinyos.dlrc.views.BasicDeclarationSetView.java
License:Open Source License
private TableViewer create(TabFolder notebook, String label, String description) { TabItem item = new TabItem(notebook, SWT.NONE); item.setText(label);//from w w w. ja v a2 s .c o m Composite panel = new Composite(notebook, SWT.NONE); panel.setLayout(new GridLayout(1, false)); item.setControl(panel); Text info = new Text(panel, SWT.READ_ONLY | SWT.WRAP); info.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); info.setText(description); TableViewer table = new TableViewer(panel, SWT.V_SCROLL | SWT.H_SCROLL); table.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); return table; }
From source file:tr.org.liderahenk.liderconsole.core.utils.SWTResourceManager.java
License:Open Source License
private static void configureTableLayout(TableViewer tableViewer) { // Configure table properties final Table table = tableViewer.getTable(); table.setHeaderVisible(true);//from w w w. j av a 2s .co m table.setLinesVisible(true); table.getVerticalBar().setEnabled(true); table.getVerticalBar().setVisible(true); // Set content provider tableViewer.setContentProvider(new ArrayContentProvider()); // Configure table layout GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.horizontalSpan = 3; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.heightHint = 420; gridData.widthHint = 600; gridData.horizontalAlignment = GridData.FILL; tableViewer.getControl().setLayoutData(gridData); }