Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 14890 Details for
Bug 75284
Inconsistant getBounds() or fillRectangle() behaviour between linux and windows
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Source code for modified SampleView.java
SampleView.java (text/plain), 3.28 KB, created by
Stephen Rowles
on 2004-09-29 10:25:19 EDT
(
hide
)
Description:
Source code for modified SampleView.java
Filename:
MIME Type:
Creator:
Stephen Rowles
Created:
2004-09-29 10:25:19 EDT
Size:
3.28 KB
patch
obsolete
>package table.test.views; > >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Table; >import org.eclipse.swt.widgets.TableColumn; >import org.eclipse.swt.widgets.TableItem; >import org.eclipse.ui.part.*; >import org.eclipse.jface.viewers.*; >import org.eclipse.swt.events.PaintEvent; >import org.eclipse.swt.events.PaintListener; >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.layout.GridData; >import org.eclipse.swt.layout.GridLayout; >import org.eclipse.jface.action.*; >import org.eclipse.jface.dialogs.MessageDialog; >import org.eclipse.ui.*; >import org.eclipse.swt.SWT; > >public class SampleView extends ViewPart { > > private static final int NUM_COLS = 3; > private static final int NUM_ROWS = 5; > > private TableViewer viewer; > private Action action1; > private Action action2; > private Action doubleClickAction; > > /** The Graphics Context used for painting table cells */ > private GC tableItemGC = null; > > /** > * The constructor. > */ > public SampleView() { > } > > /** > * This is a callback that will allow us to create the viewer and initialize it. > */ > public void createPartControl(Composite parent) { > Composite composite = new Composite(parent, SWT.NONE); > GridLayout gridLayout = new GridLayout(); > gridLayout.numColumns = 1; > composite.setLayout(gridLayout); > viewer = new TableViewer(composite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL > | SWT.V_SCROLL); > Table table = viewer.getTable(); > table.setHeaderVisible(true); > table.setLinesVisible(true); > > tableItemGC = new GC(viewer.getTable()); > tableItemGC.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); > > for (int i = 0; i < NUM_COLS; i++) { > TableColumn column = new TableColumn(table, SWT.NONE); > column.setText("Column " + i); > column.pack(); > } > > Image image = PlatformUI.getWorkbench().getSharedImages() > .getImage(ISharedImages.IMG_OBJ_FOLDER); > for (int row = 0; row < NUM_ROWS; row++) { > TableItem item = new TableItem(table, SWT.NONE); > item.setImage(0, image); > for (int col = 0; col < NUM_COLS; col++) { > item.setText(col, "item " + row + " col " + col); > } > } > > GridData gridData = new GridData(GridData.FILL_HORIZONTAL); > gridData.grabExcessHorizontalSpace = true; > table.setLayoutData(gridData); > > // Add a paint listener so that invalid cells can be painted grey > viewer.getTable().addPaintListener(new PaintListener() { > public void paintControl(PaintEvent e) { > // Paint any grey cells in the table > paintGreyCells(); > } > }); > } > > private void showMessage(String message) { > MessageDialog.openInformation(viewer.getControl().getShell(), "Sample View", message); > } > > private void paintGreyCells() { > // For each row... > for (int i = 0; i < viewer.getTable().getItemCount(); i++) { > // Get the table item, and check text to see if we grey it out > TableItem tableItem = viewer.getTable().getItem(i); > if (tableItem.getText(1).equals("item 1 col 1")) { > tableItemGC.fillRectangle(tableItem.getBounds(1)); > } > } > } > > /** > * Passing the focus request to the viewer's control. > */ > public void setFocus() { > viewer.getControl().setFocus(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 75284
:
14883
|
14884
|
14886
| 14890