Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Custom data model for cells in grid
Custom data model for cells in grid [message #41367] Wed, 24 October 2007 12:46 Go to next message
Eclipse UserFriend
Originally posted by: svo.ciklum.net

Hi!

As far as I see, we are bound to String when using Grid (even through
GridViewer), cause GridItem uses text as cell values. Is there any way
to set custom objects as cell values? This is important for our project,
as we are using different datatypes in cells.

Regards,
Stanislav
Re: Custom data model for cells in grid [message #41398 is a reply to message #41367] Wed, 24 October 2007 13:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
What is a "Object", with Viewers normally the LabelProvider makes a
String/Image presentation from the model-object, what else can you
display to the user?

Tom

Stanislav Vodetskyi schrieb:
> Hi!
>
> As far as I see, we are bound to String when using Grid (even through
> GridViewer), cause GridItem uses text as cell values. Is there any way
> to set custom objects as cell values? This is important for our project,
> as we are using different datatypes in cells.
>
> Regards,
> Stanislav


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #41430 is a reply to message #41398] Wed, 24 October 2007 14:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: svo.ciklum.net

Yes, I understand the architecture. But can we draw custom content using
label providers with GridViewer?
Regards,
Stanislav

> What is a "Object", with Viewers normally the LabelProvider makes a
> String/Image presentation from the model-object, what else can you
> display to the user?
>
> Tom
>
> Stanislav Vodetskyi schrieb:
>> Hi!
>>
>> As far as I see, we are bound to String when using Grid (even through
>> GridViewer), cause GridItem uses text as cell values. Is there any way
>> to set custom objects as cell values? This is important for our
>> project, as we are using different datatypes in cells.
>>
>> Regards,
>> Stanislav
>
>
Re: Custom data model for cells in grid [message #41460 is a reply to message #41430] Wed, 24 October 2007 14:58 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Hi,

I suppose you need to create your own cell renderer. For SWT-Tables we
provide LabelProviders who use OwnerDraw at least from Viewers-Point of
view we could invent something like this also for GridViewer but I don't
know enough about the internals of the Grid-implementation.

Tom

Stanislav Vodetskyi schrieb:
> Yes, I understand the architecture. But can we draw custom content using
> label providers with GridViewer?
> Regards,
> Stanislav
>
>> What is a "Object", with Viewers normally the LabelProvider makes a
>> String/Image presentation from the model-object, what else can you
>> display to the user?
>>
>> Tom
>>
>> Stanislav Vodetskyi schrieb:
>>> Hi!
>>>
>>> As far as I see, we are bound to String when using Grid (even through
>>> GridViewer), cause GridItem uses text as cell values. Is there any
>>> way to set custom objects as cell values? This is important for our
>>> project, as we are using different datatypes in cells.
>>>
>>> Regards,
>>> Stanislav
>>
>>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #41562 is a reply to message #41460] Wed, 24 October 2007 15:25 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
Messages: 253
Registered: July 2009
Senior Member
As Tom said you could write your own cell renderer. I'd be interested
to see a screenshot of what you are trying to achieve.

Regards,
-Chris

Tom Schindl wrote:
> Hi,
>
> I suppose you need to create your own cell renderer. For SWT-Tables we
> provide LabelProviders who use OwnerDraw at least from Viewers-Point of
> view we could invent something like this also for GridViewer but I don't
> know enough about the internals of the Grid-implementation.
>
> Tom
>
> Stanislav Vodetskyi schrieb:
>> Yes, I understand the architecture. But can we draw custom content
>> using label providers with GridViewer?
>> Regards,
>> Stanislav
>>
>>> What is a "Object", with Viewers normally the LabelProvider makes a
>>> String/Image presentation from the model-object, what else can you
>>> display to the user?
>>>
>>> Tom
>>>
>>> Stanislav Vodetskyi schrieb:
>>>> Hi!
>>>>
>>>> As far as I see, we are bound to String when using Grid (even
>>>> through GridViewer), cause GridItem uses text as cell values. Is
>>>> there any way to set custom objects as cell values? This is
>>>> important for our project, as we are using different datatypes in
>>>> cells.
>>>>
>>>> Regards,
>>>> Stanislav
>>>
>>>
>
>
Re: Custom data model for cells in grid [message #41659 is a reply to message #41562] Wed, 24 October 2007 16:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: svo.ciklum.net

Thanks for quick response!
We would try using OwnerDraw. I'll send you the screenshot as soon as we
achieve some solid results :)
We actually want to use combo-box as editor, and need renderer to look
like combo too - that leads to the need for custom drawing. Perhaps you
can advise some easier way? :)

Regards,
Stanislav

> As Tom said you could write your own cell renderer. I'd be interested
> to see a screenshot of what you are trying to achieve.
>
> Regards,
> -Chris
>
> Tom Schindl wrote:
>> Hi,
>>
>> I suppose you need to create your own cell renderer. For SWT-Tables we
>> provide LabelProviders who use OwnerDraw at least from Viewers-Point
>> of view we could invent something like this also for GridViewer but I
>> don't know enough about the internals of the Grid-implementation.
>>
>> Tom
>>
>> Stanislav Vodetskyi schrieb:
>>> Yes, I understand the architecture. But can we draw custom content
>>> using label providers with GridViewer?
>>> Regards,
>>> Stanislav
>>>
>>>> What is a "Object", with Viewers normally the LabelProvider makes a
>>>> String/Image presentation from the model-object, what else can you
>>>> display to the user?
>>>>
>>>> Tom
>>>>
>>>> Stanislav Vodetskyi schrieb:
>>>>> Hi!
>>>>>
>>>>> As far as I see, we are bound to String when using Grid (even
>>>>> through GridViewer), cause GridItem uses text as cell values. Is
>>>>> there any way to set custom objects as cell values? This is
>>>>> important for our project, as we are using different datatypes in
>>>>> cells.
>>>>>
>>>>> Regards,
>>>>> Stanislav
>>>>
>>>>
>>
>>
Re: Custom data model for cells in grid [message #41690 is a reply to message #41659] Wed, 24 October 2007 16:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Stanislav Vodetskyi schrieb:
> Thanks for quick response!
> We would try using OwnerDraw. I'll send you the screenshot as soon as we
> achieve some solid results :)
> We actually want to use combo-box as editor, and need renderer to look
> like combo too - that leads to the need for custom drawing. Perhaps you
> can advise some easier way? :)
>

That's fairly easy make a screenshot on the fly from the Combo and set
the icon onto cell :-) I'm doing this with Checkboxes and it works
fairly well [1].

Please don't mix things:
- OwnerDraw is specific to SWT-Tables/Trees you won't have any luck
using it with Grid
- CellRenders are the Grid-way of drawing custom things into
a cell

Tom

[1]http://tom-eclipse-dev.blogspot.com/2007_01_01_archive.html

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #42525 is a reply to message #41690] Mon, 29 October 2007 20:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: svo.maconomy.dk

This is a multi-part message in MIME format.
----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF/3p9iuH5unCGT5fm YciBMY8Ag2JC
GQMXH4PA/38M80FmAgQQEzD2DUARJaUvxMCs7gT020sM/PpgP8OvLx8YmDnY scqDMIuIGIOS
hwXIkQ77QxkMAAKIBcjI5+BjYOA2tQPa/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4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit



I've been playing with GridCellRenderer for some time, and couldn't
make it work under windows. I'm posting a snippet here, that works
perfectly on Mac OS X.
It also illustrates windows problems perfectly.

The class we need is ComboCellRenderer. I left some comments in the
code, to point out main problems.
- we have to hide snapshot shell from user. That is done by setting
it's location to [-100,-100] - works perfectly on mac, but not on
windows. On windows XP, when trying to get the snapshot from a shell,
located beyond the screen, we get blank area.
-in the computeSize() method we need to know the size of the cell - to
fit our combobox. This can be achieved, but requires some tricky
loopback.

To make it work on windows (if you run the snippet "as is" it will fall
into infinite loop under win xp) you need to replace renderer's
constructor with the following:

public ComboCellRenderer(Grid grid) {
this.grid = grid;
shell = new Shell(grid.getShell(), SWT.NO_TRIM);
// or use:
// shell = new Shell(grid.getDisplay(), SWT.NO_TRIM);
combo = new Combo(shell, SWT.DROP_DOWN);
combo.setLocation(0, 0);
// hide the snapshot shell from user - will not work under win xp
// platform.
// will have to find some other way round this on windows.
// shell.setLocation(-100, -100);
shell.open();
// shell.setVisible(false);
}
It will not work on mac properly with this constructor, neither with
grid.getShell() (falling into infinite loop) nor with grid.getDisplay()
(a little better, but still not good).
As you can see, shell's setLocation() method is commented - otherwise,
nothing will be drawn in a cell. I also had to comment
shell.setVisible(false) to make it work. It is not critical at all, and
can be commented on mac too, but I like when it's present
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj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JY24wWnglsHGRie32LAqhkffnkV bPABgABi+gcs
+r4+B8brE4gEO+8hBlnHMIY/QMMvb2JgOLWYgeHtE+yGvH7EwHBmDQPDw4vC ENcC4/HTU3Dw
TQQIIHBZcSKGYT+nFIODVh7Qi1ygANJkuLPXkOHmpmXg4AVhYFZlEFKGhjkQ vL4NoaUMVBhM
4rkYGP9dYjjZCTT4EcMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


Finally, you can pass either grid.getShell() to the shell constructor,
or grid.getDisplay(). In the latter case, if you move a window over
that shell, it won't be visible.
So, as you can see, the main difficulty is that we cannot hide the
snapshot shell from user on windows XP, plus there is minor difficulty
with getting cell size. Would like to hear your thoughts on how to
achieve it. Thanks in advance
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HI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HMIY/QMMvb2JgOLWYgeHtE+yGvH7EwHBmDQPDw4vC ENcC4/HTU3Dw
TQQIIHBZcSKGYT+nFIODVh7Qi1ygANJkuLPXkOHmpmXg4AVhYFZlEFKGhjkQ vL4NoaUMVBhM
4rkYGP9dYjjZCTT4EcMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit



In fact, what we really need and dream of is a cell renderer, that can
take Control as an argument and paint it on screen - like it is done in
Swing
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrB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Br00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

, because right now we will have to reimplement all basic cell
rendering, as DefaultCellRenderer cannot be extended. Are you planning
to implement something like this in near future?

**************************************
the snippet:
**************************************

package snippets;

import java.util.ArrayList;
import java.util.Random;

import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.nebula.jface.gridviewer.GridTableViewer;
import org.eclipse.nebula.jface.gridviewer.GridViewerColumn;
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridCellRenderer;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;



/**
* Snippet for demonstrating combo box rendering.
*
* @author svo
*
*/
public class SnippetComboRenderer {

public static void main(String[] args) {
final Display display = new Display();

final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setLocation(100, 100);
shell.setSize(400, 400);

// create composite
final Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new FillLayout());

//create table viewer
final GridTableViewer tableViewer = new GridTableViewer(composite);

final GridViewerColumn column = new GridViewerColumn(tableViewer, SWT.NONE);
column.getColumn().setText("Column1");
column.getColumn().setWidth(200);
column.getColumn().setCellRenderer(new
ComboCellRenderer(tableViewer.getGrid()));

tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.getGrid().setCellSelectionEnabled(true);
tableViewer.setInput(new TableInput(
----------------14973145151600932445
Content-Type: image/png; name="kopete008.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete008.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAZLSURBVHjaYmTA AtQtNigost8y
cBHa6S/P/sBBheuuwn+QBJD4D8EXgPgAkDnRbBHDA2xmAAQQIzJH1WyNAJCa LywtEGBuKs7A
xcnM8Pn1O4Yrx04xZBuvY/CwYGb4//sDw4cbFxnev2Rg+PENbMkEoAWNlksY PiCbBRBAKAYr
Gy+dr2allmBuJcMgK8LGICPMyiAFxBwsjAzz5hxm+PLpA8OkLhcGhl9AM55u YXi9q4vhwanH
DH9+g30QaL0M4XqAAGKGMbbGSCVsfO/e8ENanuHLj38MX77/Zfjy8x/DNyD+ x8DIYGulwHDr
5jOGm9dvMZgaiTAw8KswcBvFM4hI/WP4ePO0xK8fDAGJOgwL519h+AEyDyCA wAZfTmVQuPdV
av36Hx4cz//yMrz99Jfh0/d/DF/BFkAMB7ENjBQZpk3azBAfJg4Mg29gzCKh yyCiIs7w4eIR
gZ8/GSyABi8EmQkQQGCDM40Z1osKfNNY+dCBgUlKAmjoH4bX7/8wvHzzh+Hx s98MT9/8Znj1
4Q8DIxMjw+O7jxm05d4xSIj9Yz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HwzlKGUIGDDJUmV8sB AojxVBwwg/xn
2K8BjCw+ZVCy0mc4NeUBw68vHxnkrRkYFB0YcIJvb4H28CL4VxczMLw8zfDA cyODIkAAMQHL
0wOgsvXBJqAMO1Ah10UGvZQUhv/MfAw39wCzZDdQwxYGhjcPGRheP4DgO0cY GA5NYWDY08PJ
8OeXGgMb0PCf78CGgorRRpAlAAEELjaPRzOACvLzohYMAiqJIFE+hk/P0hgu zN/I8P7BbYZ/
wOz87x/CZaycnAxSBsoM+lE/GFi57zD8AZZHJ5sZGD49ZDjgtYnBEaQGIIDg 5fHRKIYEoG3z
xWyABX4aVPCfK8PHB0IMr6/+ZPj9BRSJrxlENNkZRLWAqYj5CtAB3xm+v2Jg ONcFNPQ+uCw2
BBoMLvABAgiloD8cATScgaGfW45BQCmegUFAiwEveLqPgeH6XGCK/MJwAcgN BBoKL+gBAogR
XfHBcAYDoMv7gdiBW4GBQcIemETlUdW8PMnA8AqIv72CVE1AoUaYS2EAIIAY cblmXyiDA7Dy
jP/3H0yDK9P/yJUpA8MBoPhEz03YK1OAAAMA77NeQD9zzicAAAAASUVORK5C YII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

);
tableViewer.getGrid().setLinesVisible(true);
tableViewer.getGrid().setHeaderVisible(true);

shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

@SuppressWarnings("serial")
static class TableInput extends ArrayList<String[]> {

private final String[] values = {"Noise", "Electronic", "Experimental",
"Industrial"};

public TableInput(final int size) {
final Random random = new Random();

for (int i = 0; i<size; i++) {
add(new String[] {values[random.nextInt(values.length-1)]});
}

}

}


static class TableLabelProvider extends LabelProvider implements
ITableLabelProvider{

@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}

@Override
public String getColumnText(Object element, int columnIndex) {
final String[] row = (String[]) element;
return row[columnIndex];
}

}

static class ComboCellRenderer extends GridCellRenderer {

private final Grid grid;
private final Combo combo;
private final Shell shell;

public ComboCellRenderer(Grid grid) {
this.grid = grid;
shell = new Shell(grid.getDisplay(), SWT.NO_TRIM);
combo = new Combo(shell,SWT.DROP_DOWN);
combo.setLocation(0, 0);
//hide the snapshot shell from user - will not work under win xp platform.
//will have to find some other way round this on windows.
shell.setLocation(-100, -100);
shell.open();
shell.setVisible(false);
}


@Override
public boolean notify(int event, Point point, Object value) {
return false;
}

@Override
public Point computeSize(GC gc, int hint, int hint2, Object value) {
final Point rendererSize = getSize();
//renderer size is [0,0]. Need to get to know cell size somehow.
//we can get it from grid, but this kind of loopback is not very good
looking (plus, it won't always return correct item height)
//but it works, in fact
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF/3p9iuH5unCGT5fm YciBMY8Ag2JC
GQMXH4PA/38M80FmAgQQEzD2DUARJaUvxMCs7gT020sM/PpgP8OvLx8YmDnY scqDMIuIGIOS
hwXIkQ77QxkMAAKIBcjI5+BjYOA2tQPa/hLDlz/fvWT49vIRAyMwVXBL8q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vjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


final Point comboSize = combo.computeSize(hint, hint2);
final Point gridCellSize = new
Point(grid.getColumn(getColumn()).getWidth(),
Math.max(grid.getItemHeight(),comboSize.y));
combo.setSize(gridCellSize);

return combo.getSize();
}

@Override
public void paint(GC gc, Object value) {
final GridItem item = (GridItem) value;
System.out.println(item.getText(getColumn()));
combo.setItems(new String[] {item.getText(getColumn())});
combo.select(0);
shell.setSize(combo.getSize());
gc.drawImage(takeSnapshot(), getBounds().x, getBounds().y);
}

private Image takeSnapshot() {
shell.setVisible(true);
final Image image = new Image(shell.getDisplay(), getBounds().width,
getBounds().height);
final GC gc = new GC(combo);
gc.copyArea(image, 0, 0);
shell.setVisible(false);
gc.dispose();

return image;

}

}


}

***********************************

Regards,
Stanislav


Tom Schindl ><tom.schindl@bestsolution.at> wrote:
>Stanislav Vodetskyi schrieb:
>> Thanks for quick response!
>> We would try using OwnerDraw. I'll send you the screenshot as soon as we
>> achieve some solid results
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqH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cMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


>> We actually want to use combo-box as editor, and need renderer to look
>> like combo too - that leads to the need for custom drawing. Perhaps you
>> can advise some easier way?
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF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w8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


>>
>
>That's fairly easy make a screenshot on the fly from the Combo and set
>the icon onto cell
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF/3p9iuH5unCGT5fm YciBMY8Ag2JC
GQMXH4PA/38M80FmAgQQEzD2DUARJaUvxMCs7gT020sM/PpgP8OvLx8YmDnY scqDMIuIGIOS
hwXIkQ77QxkMAAKIBcjI5+BjYOA2tQPa/hLDlz/fvWT49vIRAyMwVXBL8qGo e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JNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

I'm doing this with Checkboxes and it works
>fairly well [1].
>
>Please don't mix things:
>- OwnerDraw is specific to SWT-Tables/Trees you won't have any luck
> using it with Grid
>- CellRenders are the Grid-way of drawing custom things into
> a cell
>
>Tom
>
>[1]http://tom-eclipse-dev.blogspot.com/2007_01_01_archive.html
>
>--
>B e s t S o l u t i o n . at
> ------------------------------------------------------------ --------
>Tom Schindl JFace-Committer
> ------------------------------------------------------------ --------



--

----------------14973145151600932445--
Re: Custom data model for cells in grid [message #42556 is a reply to message #42525] Mon, 29 October 2007 21:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Hi,

just one note you are leaking resources like hell because you are not
disposing images you create.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #42587 is a reply to message #42556] Tue, 30 October 2007 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: svo.ciklum.net

Hi,

Thanks, strangely I didn't notice it myself. One more thing - it would
be cool, if we could draw snapshot of the focused combobox - right now
it's grayed, cause we take snapshot of the background window. Setting
focus directly in the paint method is not good. Is there any way to
force component look like it is active?
Also still don't know how to hide snapshot shell on windows xp.

Thanks in advance :)

Regards,
Stanislav

Tom Schindl wrote:
> Hi,
>
> just one note you are leaking resources like hell because you are not
> disposing images you create.
>
> Tom
>
Re: Custom data model for cells in grid [message #42646 is a reply to message #42587] Tue, 30 October 2007 17:49 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 253
Registered: July 2009
Senior Member
I don't think SWT has a solution to capturing images from hidden
widgets. There are some existing bug reports on this in bugzilla.

Regards,
-Chris

Stanislav Vodetskyi wrote:
> Hi,
>
> Thanks, strangely I didn't notice it myself. One more thing - it would
> be cool, if we could draw snapshot of the focused combobox - right now
> it's grayed, cause we take snapshot of the background window. Setting
> focus directly in the paint method is not good. Is there any way to
> force component look like it is active?
> Also still don't know how to hide snapshot shell on windows xp.
>
> Thanks in advance :)
>
> Regards,
> Stanislav
>
> Tom Schindl wrote:
>> Hi,
>>
>> just one note you are leaking resources like hell because you are not
>> disposing images you create.
>>
>> Tom
>>
Re: Custom data model for cells in grid [message #585445 is a reply to message #41367] Wed, 24 October 2007 13:52 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
What is a "Object", with Viewers normally the LabelProvider makes a
String/Image presentation from the model-object, what else can you
display to the user?

Tom

Stanislav Vodetskyi schrieb:
> Hi!
>
> As far as I see, we are bound to String when using Grid (even through
> GridViewer), cause GridItem uses text as cell values. Is there any way
> to set custom objects as cell values? This is important for our project,
> as we are using different datatypes in cells.
>
> Regards,
> Stanislav


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #585462 is a reply to message #41398] Wed, 24 October 2007 14:16 Go to previous message
blutkind  is currently offline blutkind Friend
Messages: 25
Registered: July 2009
Junior Member
Yes, I understand the architecture. But can we draw custom content using
label providers with GridViewer?
Regards,
Stanislav

> What is a "Object", with Viewers normally the LabelProvider makes a
> String/Image presentation from the model-object, what else can you
> display to the user?
>
> Tom
>
> Stanislav Vodetskyi schrieb:
>> Hi!
>>
>> As far as I see, we are bound to String when using Grid (even through
>> GridViewer), cause GridItem uses text as cell values. Is there any way
>> to set custom objects as cell values? This is important for our
>> project, as we are using different datatypes in cells.
>>
>> Regards,
>> Stanislav
>
>
Re: Custom data model for cells in grid [message #585475 is a reply to message #41430] Wed, 24 October 2007 14:58 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Hi,

I suppose you need to create your own cell renderer. For SWT-Tables we
provide LabelProviders who use OwnerDraw at least from Viewers-Point of
view we could invent something like this also for GridViewer but I don't
know enough about the internals of the Grid-implementation.

Tom

Stanislav Vodetskyi schrieb:
> Yes, I understand the architecture. But can we draw custom content using
> label providers with GridViewer?
> Regards,
> Stanislav
>
>> What is a "Object", with Viewers normally the LabelProvider makes a
>> String/Image presentation from the model-object, what else can you
>> display to the user?
>>
>> Tom
>>
>> Stanislav Vodetskyi schrieb:
>>> Hi!
>>>
>>> As far as I see, we are bound to String when using Grid (even through
>>> GridViewer), cause GridItem uses text as cell values. Is there any
>>> way to set custom objects as cell values? This is important for our
>>> project, as we are using different datatypes in cells.
>>>
>>> Regards,
>>> Stanislav
>>
>>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #585548 is a reply to message #41460] Wed, 24 October 2007 15:25 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
As Tom said you could write your own cell renderer. I'd be interested
to see a screenshot of what you are trying to achieve.

Regards,
-Chris

Tom Schindl wrote:
> Hi,
>
> I suppose you need to create your own cell renderer. For SWT-Tables we
> provide LabelProviders who use OwnerDraw at least from Viewers-Point of
> view we could invent something like this also for GridViewer but I don't
> know enough about the internals of the Grid-implementation.
>
> Tom
>
> Stanislav Vodetskyi schrieb:
>> Yes, I understand the architecture. But can we draw custom content
>> using label providers with GridViewer?
>> Regards,
>> Stanislav
>>
>>> What is a "Object", with Viewers normally the LabelProvider makes a
>>> String/Image presentation from the model-object, what else can you
>>> display to the user?
>>>
>>> Tom
>>>
>>> Stanislav Vodetskyi schrieb:
>>>> Hi!
>>>>
>>>> As far as I see, we are bound to String when using Grid (even
>>>> through GridViewer), cause GridItem uses text as cell values. Is
>>>> there any way to set custom objects as cell values? This is
>>>> important for our project, as we are using different datatypes in
>>>> cells.
>>>>
>>>> Regards,
>>>> Stanislav
>>>
>>>
>
>
Re: Custom data model for cells in grid [message #585585 is a reply to message #41562] Wed, 24 October 2007 16:24 Go to previous message
blutkind  is currently offline blutkind Friend
Messages: 25
Registered: July 2009
Junior Member
Thanks for quick response!
We would try using OwnerDraw. I'll send you the screenshot as soon as we
achieve some solid results :)
We actually want to use combo-box as editor, and need renderer to look
like combo too - that leads to the need for custom drawing. Perhaps you
can advise some easier way? :)

Regards,
Stanislav

> As Tom said you could write your own cell renderer. I'd be interested
> to see a screenshot of what you are trying to achieve.
>
> Regards,
> -Chris
>
> Tom Schindl wrote:
>> Hi,
>>
>> I suppose you need to create your own cell renderer. For SWT-Tables we
>> provide LabelProviders who use OwnerDraw at least from Viewers-Point
>> of view we could invent something like this also for GridViewer but I
>> don't know enough about the internals of the Grid-implementation.
>>
>> Tom
>>
>> Stanislav Vodetskyi schrieb:
>>> Yes, I understand the architecture. But can we draw custom content
>>> using label providers with GridViewer?
>>> Regards,
>>> Stanislav
>>>
>>>> What is a "Object", with Viewers normally the LabelProvider makes a
>>>> String/Image presentation from the model-object, what else can you
>>>> display to the user?
>>>>
>>>> Tom
>>>>
>>>> Stanislav Vodetskyi schrieb:
>>>>> Hi!
>>>>>
>>>>> As far as I see, we are bound to String when using Grid (even
>>>>> through GridViewer), cause GridItem uses text as cell values. Is
>>>>> there any way to set custom objects as cell values? This is
>>>>> important for our project, as we are using different datatypes in
>>>>> cells.
>>>>>
>>>>> Regards,
>>>>> Stanislav
>>>>
>>>>
>>
>>
Re: Custom data model for cells in grid [message #585603 is a reply to message #41659] Wed, 24 October 2007 16:40 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Stanislav Vodetskyi schrieb:
> Thanks for quick response!
> We would try using OwnerDraw. I'll send you the screenshot as soon as we
> achieve some solid results :)
> We actually want to use combo-box as editor, and need renderer to look
> like combo too - that leads to the need for custom drawing. Perhaps you
> can advise some easier way? :)
>

That's fairly easy make a screenshot on the fly from the Combo and set
the icon onto cell :-) I'm doing this with Checkboxes and it works
fairly well [1].

Please don't mix things:
- OwnerDraw is specific to SWT-Tables/Trees you won't have any luck
using it with Grid
- CellRenders are the Grid-way of drawing custom things into
a cell

Tom

[1]http://tom-eclipse-dev.blogspot.com/2007_01_01_archive.html

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #586009 is a reply to message #41690] Mon, 29 October 2007 20:16 Go to previous message
blutkind  is currently offline blutkind Friend
Messages: 25
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Hi
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF/3p9iuH5unCGT5fm YciBMY8Ag2JC
GQMXH4PA/38M80FmAgQQEzD2DUARJaUvxMCs7gT020sM/PpgP8OvLx8YmDnY scqDMIuIGIOS
hwXIkQ77QxkMAA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3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit



I've been playing with GridCellRenderer for some time, and couldn't
make it work under windows. I'm posting a snippet here, that works
perfectly on Mac OS X.
It also illustrates windows problems perfectly.

The class we need is ComboCellRenderer. I left some comments in the
code, to point out main problems.
- we have to hide snapshot shell from user. That is done by setting
it's location to [-100,-100] - works perfectly on mac, but not on
windows. On windows XP, when trying to get the snapshot from a shell,
located beyond the screen, we get blank area.
-in the computeSize() method we need to know the size of the cell - to
fit our combobox. This can be achieved, but requires some tricky
loopback.

To make it work on windows (if you run the snippet "as is" it will fall
into infinite loop under win xp) you need to replace renderer's
constructor with the following:

public ComboCellRenderer(Grid grid) {
this.grid = grid;
shell = new Shell(grid.getShell(), SWT.NO_TRIM);
// or use:
// shell = new Shell(grid.getDisplay(), SWT.NO_TRIM);
combo = new Combo(shell, SWT.DROP_DOWN);
combo.setLocation(0, 0);
// hide the snapshot shell from user - will not work under win xp
// platform.
// will have to find some other way round this on windows.
// shell.setLocation(-100, -100);
shell.open();
// shell.setVisible(false);
}
It will not work on mac properly with this constructor, neither with
grid.getShell() (falling into infinite loop) nor with grid.getDisplay()
(a little better, but still not good).
As you can see, shell's setLocation() method is commented - otherwise,
nothing will be drawn in a cell. I also had to comment
shell.setVisible(false) to make it work. It is not critical at all, and
can be commented on mac too, but I like when it's present
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS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djFDwACiAlUSr2/BQpMCJY24wWnglsHGRie32LAqhkffnkV bPABgABi+gcs
+r4+B8brE4gEO+8hBlnHMIY/QMMvb2JgOLWYgeHtE+yGvH7EwHBmDQPDw4vC ENcC4/HTU3Dw
TQQIIHBZcSKGYT+nFIODVh7Qi1ygANJkuLPXkOHmpmXg4AVhYFZlEFKGhjkQ vL4NoaUMVBhM
4rkYGP9dYjjZCTT4EcMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


Finally, you can pass either grid.getShell() to the shell constructor,
or grid.getDisplay(). In the latter case, if you move a window over
that shell, it won't be visible.
So, as you can see, the main difficulty is that we cannot hide the
snapshot shell from user on windows XP, plus there is minor difficulty
with getting cell size. Would like to hear your thoughts on how to
achieve it. Thanks in advance
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0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
+r4+B8brE4gEO+8hBlnHMIY/QMMvb2JgOLWYgeHtE+yGvH7EwHBmDQPDw4vC ENcC4/HTU3Dw
TQQIIHBZcSKGYT+nFIODVh7Qi1ygANJkuLPXkOHmpmXg4AVhYFZlEFKGhjkQ vL4NoaUMVBhM
4rkYGP9dYjjZCTT4EcMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit



In fact, what we really need and dream of is a cell renderer, that can
take Control as an argument and paint it on screen - like it is done in
Swing
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIM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4rkYGP9dYjjZCTT4EcMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

, because right now we will have to reimplement all basic cell
rendering, as DefaultCellRenderer cannot be extended. Are you planning
to implement something like this in near future?

**************************************
the snippet:
**************************************

package snippets;

import java.util.ArrayList;
import java.util.Random;

import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.nebula.jface.gridviewer.GridTableViewer;
import org.eclipse.nebula.jface.gridviewer.GridViewerColumn;
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridCellRenderer;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;



/**
* Snippet for demonstrating combo box rendering.
*
* @author svo
*
*/
public class SnippetComboRenderer {

public static void main(String[] args) {
final Display display = new Display();

final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setLocation(100, 100);
shell.setSize(400, 400);

// create composite
final Composite composite = new Composite(shell, SWT.NONE);
composite.setLayout(new FillLayout());

//create table viewer
final GridTableViewer tableViewer = new GridTableViewer(composite);

final GridViewerColumn column = new GridViewerColumn(tableViewer, SWT.NONE);
column.getColumn().setText("Column1");
column.getColumn().setWidth(200);
column.getColumn().setCellRenderer(new
ComboCellRenderer(tableViewer.getGrid()));

tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.getGrid().setCellSelectionEnabled(true);
tableViewer.setInput(new TableInput(
----------------14973145151600932445
Content-Type: image/png; name="kopete008.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete008.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAZLSURBVHjaYmTA AtQtNigost8y
cBHa6S/P/sBBheuuwn+QBJD4D8EXgPgAkDnRbBHDA2xmAAQQIzJH1WyNAJCa LywtEGBuKs7A
xcnM8Pn1O4Yrx04xZBuvY/CwYGb4//sDw4cbFxnev2Rg+PENbMkEoAWNlksY PiCbBRBAKAYr
Gy+dr2allmBuJcMgK8LGICPMyiAFxBwsjAzz5hxm+PLpA8OkLhcGhl9AM55u YXi9q4vhwanH
DH9+g30QaL0M4XqAAGKGMbbGSCVsfO/e8ENanuHLj38MX77/Zfjy8x/DNyD+ x8DIYGulwHDr
5jOGm9dvMZgaiTAw8KswcBvFM4hI/WP4ePO0xK8fDAGJOgwL519h+AEyDyCA wAZfTmVQuPdV
av36Hx4cz//yMrz99Jfh0/d/DF/BFkAMB7ENjBQZpk3azBAfJg4Mg29gzCKh yyCiIs7w4eIR
gZ8/GSyABi8EmQkQQGCDM40Z1osKfNNY+dCBgUlKAmjoH4bX7/8wvHzzh+Hx s98MT9/8Znj1
4Q8DIxM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vMc4Y/Hz8w/Lh9ikHwzlKGUIGDDJUmV8sB AojxVBwwg/xn
2K8BjCw+ZVCy0mc4NeUBw68vHxnkrRkYFB0YcIJvb4H28CL4VxczMLw8zfDA cyODIkAAMQHL
0wOgsvXBJqAMO1Ah10UGvZQUhv/MfAw39wCzZDdQwxYGhjcPGRheP4DgO0cY GA5NYWDY08PJ
8OeXGgMb0PCf78CGgorRRpAlAAEELjaPRzOACvLzohYMAiqJIFE+hk/P0hgu zN/I8P7BbYZ/
wOz87x/CZaycnAxSBsoM+lE/GFi57zD8AZZHJ5sZGD49ZDjgtYnBEaQGIIDg 5fHRKIYEoG3z
xWyABX4aVPCfK8PHB0IMr6/+ZPj9BRSJrxlENNkZRLWAqYj5CtAB3xm+v2Jg ONcFNPQ+uCw2
BBoMLvABAgiloD8cATScgaGfW45BQCmegUFAiwEveLqPgeH6XGCK/MJwAcgN BBoKL+gBAogR
XfHBcAYDoMv7gdiBW4GBQcIemETlUdW8PMnA8AqIv72CVE1AoUaYS2EAIIAY cblmXyiDA7Dy
jP/3H0yDK9P/yJUpA8MBoPhEz03YK1OAAAMA77NeQD9zzicAAAAASUVORK5C YII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

);
tableViewer.getGrid().setLinesVisible(true);
tableViewer.getGrid().setHeaderVisible(true);

shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

@SuppressWarnings("serial")
static class TableInput extends ArrayList<String[]> {

private final String[] values = {"Noise", "Electronic", "Experimental",
"Industrial"};

public TableInput(final int size) {
final Random random = new Random();

for (int i = 0; i<size; i++) {
add(new String[] {values[random.nextInt(values.length-1)]});
}

}

}


static class TableLabelProvider extends LabelProvider implements
ITableLabelProvider{

@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}

@Override
public String getColumnText(Object element, int columnIndex) {
final String[] row = (String[]) element;
return row[columnIndex];
}

}

static class ComboCellRenderer extends GridCellRenderer {

private final Grid grid;
private final Combo combo;
private final Shell shell;

public ComboCellRenderer(Grid grid) {
this.grid = grid;
shell = new Shell(grid.getDisplay(), SWT.NO_TRIM);
combo = new Combo(shell,SWT.DROP_DOWN);
combo.setLocation(0, 0);
//hide the snapshot shell from user - will not work under win xp platform.
//will have to find some other way round this on windows.
shell.setLocation(-100, -100);
shell.open();
shell.setVisible(false);
}


@Override
public boolean notify(int event, Point point, Object value) {
return false;
}

@Override
public Point computeSize(GC gc, int hint, int hint2, Object value) {
final Point rendererSize = getSize();
//renderer size is [0,0]. Need to get to know cell size somehow.
//we can get it from grid, but this kind of loopback is not very good
looking (plus, it won't always return correct item height)
//but it works, in fact
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF/3p9iuH5unCGT5fm YciBMY8Ag2JC
GQMXH4PA/38M80FmAgQQEzD2DUARJaUvxMCs7gT020sM/PpgP8OvLx8YmDnY scqDMIuIGIOS
hwXIkQ77QxkMAAKIBcjI5+BjYOA2tQPa/hLDlz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
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


final Point comboSize = combo.computeSize(hint, hint2);
final Point gridCellSize = new
Point(grid.getColumn(getColumn()).getWidth(),
Math.max(grid.getItemHeight(),comboSize.y));
combo.setSize(gridCellSize);

return combo.getSize();
}

@Override
public void paint(GC gc, Object value) {
final GridItem item = (GridItem) value;
System.out.println(item.getText(getColumn()));
combo.setItems(new String[] {item.getText(getColumn())});
combo.select(0);
shell.setSize(combo.getSize());
gc.drawImage(takeSnapshot(), getBounds().x, getBounds().y);
}

private Image takeSnapshot() {
shell.setVisible(true);
final Image image = new Image(shell.getDisplay(), getBounds().width,
getBounds().height);
final GC gc = new GC(combo);
gc.copyArea(image, 0, 0);
shell.setVisible(false);
gc.dispose();

return image;

}

}


}

***********************************

Regards,
Stanislav


Tom Schindl ><tom.schindl@bestsolution.at> wrote:
>Stanislav Vodetskyi schrieb:
>> Thanks for quick response!
>> We would try using OwnerDraw. I'll send you the screenshot as soon as we
>> achieve some solid results
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YP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M
4rkYGP9dYjjZCTT4EcMBr00MjgABBIoOhmRdhoO/PjMk/P7CwCFkAjL4DYOQ 6g8g9mH49ZmT
4ePTJ2DDv70F4negoksIaKAOg36kNIO6zzNgVn/AcHUh0LJLDB+Asp5LbzJ8 AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


>> We actually want to use combo-box as editor, and need renderer to look
>> like combo too - that leads to the need for custom drawing. Perhaps you
>> can advise some easier way?
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQ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AAggeLF5NApY
bP5nWC9mw8CgGAN1OThVKADTsBHD7y9sDF/ffGYQkAfawPgGqOAKOHL/fGVg uA4sdp7sB6sO
BLoWXGwCBBBKQX84AlLQc8szCCjFAXORFv6y+B3Q7Otzgd6/B3ZpIsxQEAAI IIyq6WA4sGz+
D6yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit


>>
>
>That's fairly easy make a screenshot on the fly from the Combo and set
>the icon onto cell
----------------14973145151600932445
Content-Type: image/png; name="kopete020.png"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="kopete020.png"

iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAAK/I NwWK6QAAABl0
RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAS/SURBVHjaYmTA AS6lMDj8Z2CI
Z/gPpP8zKADZDEAaghkYHgDpA0A80WwRwwVs+gECiBFd4HIq2JD5QE0OHDwM DHyiDAw8ivoM
DKwCYHmQBZ9vHGR4/5KB4etHMB9kQaLlEoYHyOYABBAjmqEBIEOBBgpIGcgy cFuXMTBI+zAw
sAlgOunJZoZPJ2cwPDxwjOHLR4YPIMOtlzFsgEkDBBAjmqHrBSUYGCT9sxmY dfMZiAF/Hu1i
eLCwkuHlvc8g5wfaLIcYDhBAjEjePw80VEAmupKBQc4Hw4C/374wMLKLMDAx /8A0/eMthttT
chle3v3yAWiOod0KhgcAAcQEDTew9yW9w4BeNwOa8goF/3p9iuH5unCGT5fm YciBMY8Ag2JC
GQMXH4PA/38M80FmAgQQEzD2DUARJaUvxMCs7gT020sM/PpgP8OvLx8YmDnY scqDMIuIGIOS
hwXIkQ77QxkMAAKIBcjI5+BjYOA2tQPa/hLDlz/fv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yagKUU0AIGERNMC0AGvjwJNPA+JAVADUWpmgACiBGXa0BFH1BTPjDVOAC5 CvCKFKkyBcW+
5ybslSlAgAEAaOLXpbt84FkAAAAASUVORK5CYII=

----------------14973145151600932445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

I'm doing this with Checkboxes and it works
>fairly well [1].
>
>Please don't mix things:
>- OwnerDraw is specific to SWT-Tables/Trees you won't have any luck
> using it with Grid
>- CellRenders are the Grid-way of drawing custom things into
> a cell
>
>Tom
>
>[1]http://tom-eclipse-dev.blogspot.com/2007_01_01_archive.html
>
>--
>B e s t S o l u t i o n . at
> ------------------------------------------------------------ --------
>Tom Schindl JFace-Committer
> ------------------------------------------------------------ --------



--

----------------14973145151600932445--
Re: Custom data model for cells in grid [message #586021 is a reply to message #42525] Mon, 29 October 2007 21:39 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Hi,

just one note you are leaking resources like hell because you are not
disposing images you create.

Tom

--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Custom data model for cells in grid [message #586041 is a reply to message #42556] Tue, 30 October 2007 09:58 Go to previous message
blutkind  is currently offline blutkind Friend
Messages: 25
Registered: July 2009
Junior Member
Hi,

Thanks, strangely I didn't notice it myself. One more thing - it would
be cool, if we could draw snapshot of the focused combobox - right now
it's grayed, cause we take snapshot of the background window. Setting
focus directly in the paint method is not good. Is there any way to
force component look like it is active?
Also still don't know how to hide snapshot shell on windows xp.

Thanks in advance :)

Regards,
Stanislav

Tom Schindl wrote:
> Hi,
>
> just one note you are leaking resources like hell because you are not
> disposing images you create.
>
> Tom
>
Re: Custom data model for cells in grid [message #586078 is a reply to message #42587] Tue, 30 October 2007 17:49 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
I don't think SWT has a solution to capturing images from hidden
widgets. There are some existing bug reports on this in bugzilla.

Regards,
-Chris

Stanislav Vodetskyi wrote:
> Hi,
>
> Thanks, strangely I didn't notice it myself. One more thing - it would
> be cool, if we could draw snapshot of the focused combobox - right now
> it's grayed, cause we take snapshot of the background window. Setting
> focus directly in the paint method is not good. Is there any way to
> force component look like it is active?
> Also still don't know how to hide snapshot shell on windows xp.
>
> Thanks in advance :)
>
> Regards,
> Stanislav
>
> Tom Schindl wrote:
>> Hi,
>>
>> just one note you are leaking resources like hell because you are not
>> disposing images you create.
>>
>> Tom
>>
Previous Topic:How to provide tooltip text for images in grid view?
Next Topic:PShelf in JPanel
Goto Forum:
  


Current Time: Sat Nov 29 09:03:44 GMT 2014

Powered by FUDForum. Page generated in 0.03292 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software