Home » Eclipse Projects » Nebula » Grid - DefaultCellRenderer
Grid - DefaultCellRenderer [message #18938] |
Fri, 01 December 2006 15:33 |
Eclipse User |
|
|
|
Originally posted by: x_naren.hotmail.com
Chris,
I noticed this code from defaultcellrenderer while I was trying to do
custom cell renderer, looks like a mistake to me
method -- paint -- notice the cellfocus section -- why 2 ifs
if (isCellFocus) {
.........
}
else if (isCellFocus) {
.................
}
Anyways, my objective is to decrease the cell ht , when the shell ht is
decreased, iam trying to decrease the font ht when the shell ht is
decreased.
Thanks
Naren
-------------------------------------------
public void paint(GC gc, Object value) {
.............
if (isCellFocus())
{
Rectangle focusRect = new Rectangle(getBounds().x -1,
getBounds().y - 1, getBounds().width,
getBounds().height + 1);
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_ FOREGROUND));
gc.drawRectangle(focusRect);
if (isFocus())
{
focusRect.x ++;
focusRect.width -= 2;
focusRect.y ++;
focusRect.height -= 2;
gc.drawRectangle(focusRect);
}
}
else if (isCellFocus())
{
Rectangle focusRect = new Rectangle(getBounds().x -1,
getBounds().y - 1, getBounds().width,
getBounds().height + 1);
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGE T_DARK_SHADOW));
gc.drawLine(focusRect.x,focusRect.y,focusRect.x +
focusRect.width,focusRect.y);
gc.drawLine(focusRect.x,focusRect.y +
focusRect.height,focusRect.x + focusRect.width,focusRect.y +
focusRect.height);
gc.drawLine(focusRect.x,focusRect.y,focusRect.x,focusRect.y +
focusRect.height);
gc.drawLine(focusRect.x +
focusRect.width,focusRect.y,focusRect.x + focusRect.width,focusRect.y +
focusRect.height);
if (isFocus())
{
gc.drawLine(focusRect.x,focusRect.y + 1,focusRect.x +
focusRect.width,focusRect.y + 1);
gc.drawLine(focusRect.x,focusRect.y + focusRect.height
-1,focusRect.x + focusRect.width,focusRect.y + focusRect.height -1);
gc.drawLine(focusRect.x + 1,focusRect.y,focusRect.x +
1,focusRect.y + focusRect.height);
gc.drawLine(focusRect.x + focusRect.width
-1,focusRect.y,focusRect.x + focusRect.width -1,focusRect.y +
focusRect.height);
}
}
}
|
|
|
Re: Grid - DefaultCellRenderer [message #18962 is a reply to message #18938] |
Fri, 01 December 2006 16:27 |
Chris Gross Messages: 253 Registered: July 2009 |
Senior Member |
|
|
The two if's are different. Its isCellFocus and isFocus and they are
different. isCellFocus returns whether the cell is the focused cell
within the grid. isFocus returns whether the grid is the focused widget.
As to what you're trying to do, thats currently not possible. The row
height is determined by the cell renderer, but it is only done once when
the first row is created. You cannot dynamically change the row height.
You can add a bugzilla issue for that feature if its important to you.
Regards,
-Chris
Naren wrote:
> Chris,
>
> I noticed this code from defaultcellrenderer while I was trying to do
> custom cell renderer, looks like a mistake to me
>
> method -- paint -- notice the cellfocus section -- why 2 ifs
>
> if (isCellFocus) {
> .........
> }
> else if (isCellFocus) {
> .................
> }
>
> Anyways, my objective is to decrease the cell ht , when the shell ht is
> decreased, iam trying to decrease the font ht when the shell ht is
> decreased.
>
> Thanks
>
> Naren
>
>
> -------------------------------------------
> public void paint(GC gc, Object value) {
>
> .............
>
> if (isCellFocus())
> {
> Rectangle focusRect = new Rectangle(getBounds().x -1,
> getBounds().y - 1, getBounds().width,
> getBounds().height + 1);
>
> gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_ FOREGROUND));
> gc.drawRectangle(focusRect);
> if (isFocus())
> {
> focusRect.x ++;
> focusRect.width -= 2;
> focusRect.y ++;
> focusRect.height -= 2;
> gc.drawRectangle(focusRect);
> }
> }
> else if (isCellFocus())
> {
> Rectangle focusRect = new Rectangle(getBounds().x -1,
> getBounds().y - 1, getBounds().width,
> getBounds().height + 1);
>
> gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGE T_DARK_SHADOW));
>
>
> gc.drawLine(focusRect.x,focusRect.y,focusRect.x +
> focusRect.width,focusRect.y);
> gc.drawLine(focusRect.x,focusRect.y +
> focusRect.height,focusRect.x + focusRect.width,focusRect.y +
> focusRect.height);
> gc.drawLine(focusRect.x,focusRect.y,focusRect.x,focusRect.y +
> focusRect.height);
> gc.drawLine(focusRect.x +
> focusRect.width,focusRect.y,focusRect.x + focusRect.width,focusRect.y +
> focusRect.height);
> if (isFocus())
> {
> gc.drawLine(focusRect.x,focusRect.y + 1,focusRect.x +
> focusRect.width,focusRect.y + 1);
> gc.drawLine(focusRect.x,focusRect.y + focusRect.height
> -1,focusRect.x + focusRect.width,focusRect.y + focusRect.height -1);
> gc.drawLine(focusRect.x + 1,focusRect.y,focusRect.x +
> 1,focusRect.y + focusRect.height);
> gc.drawLine(focusRect.x + focusRect.width
> -1,focusRect.y,focusRect.x + focusRect.width -1,focusRect.y +
> focusRect.height);
> }
> }
>
>
> }
>
|
|
|
Re: Grid - DefaultCellRenderer [message #19027 is a reply to message #18962] |
Fri, 01 December 2006 17:49 |
Eclipse User |
|
|
|
Originally posted by: x_naren.hotmail.com
I found that the hard way. computeRowHeight does that. only when first row
is created.
I tried the similar thing with SWT - Table, font ht works there except
that it does not many other features
we are looking for a
table with no scroll bars
customizable cells
different cell borders / colors
multiple colors in cells
multiple fonts in cells
resize table when the shell is resized
fixed columns widths
resize cell ht when shell is resized
I was able to do most of the requirements except resize Heights. Looks
like that I need to work towards a CUSTOM table.
Thanks
Naren
Chris Gross wrote:
> The two if's are different. Its isCellFocus and isFocus and they are
> different. isCellFocus returns whether the cell is the focused cell
> within the grid. isFocus returns whether the grid is the focused widget.
> As to what you're trying to do, thats currently not possible. The row
> height is determined by the cell renderer, but it is only done once when
> the first row is created. You cannot dynamically change the row height.
> You can add a bugzilla issue for that feature if its important to you.
> Regards,
> -Chris
> Naren wrote:
>> Chris,
>>
>> I noticed this code from defaultcellrenderer while I was trying to do
>> custom cell renderer, looks like a mistake to me
>>
>> method -- paint -- notice the cellfocus section -- why 2 ifs
>>
>> if (isCellFocus) {
>> .........
>> }
>> else if (isCellFocus) {
>> .................
>> }
>>
>> Anyways, my objective is to decrease the cell ht , when the shell ht is
>> decreased, iam trying to decrease the font ht when the shell ht is
>> decreased.
>>
>> Thanks
>>
>> Naren
>>
>>
>> -------------------------------------------
>> public void paint(GC gc, Object value) {
>>
>> .............
>>
>> if (isCellFocus())
>> {
>> Rectangle focusRect = new Rectangle(getBounds().x -1,
>> getBounds().y - 1, getBounds().width,
>> getBounds().height + 1);
>>
>> gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_ FOREGROUND));
>> gc.drawRectangle(focusRect);
>> if (isFocus())
>> {
>> focusRect.x ++;
>> focusRect.width -= 2;
>> focusRect.y ++;
>> focusRect.height -= 2;
>> gc.drawRectangle(focusRect);
>> }
>> }
>> else if (isCellFocus())
>> {
>> Rectangle focusRect = new Rectangle(getBounds().x -1,
>> getBounds().y - 1, getBounds().width,
>> getBounds().height + 1);
>>
>>
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGE T_DARK_SHADOW));
>>
>>
>> gc.drawLine(focusRect.x,focusRect.y,focusRect.x +
>> focusRect.width,focusRect.y);
>> gc.drawLine(focusRect.x,focusRect.y +
>> focusRect.height,focusRect.x + focusRect.width,focusRect.y +
>> focusRect.height);
>> gc.drawLine(focusRect.x,focusRect.y,focusRect.x,focusRect.y +
>> focusRect.height);
>> gc.drawLine(focusRect.x +
>> focusRect.width,focusRect.y,focusRect.x + focusRect.width,focusRect.y +
>> focusRect.height);
>> if (isFocus())
>> {
>> gc.drawLine(focusRect.x,focusRect.y + 1,focusRect.x +
>> focusRect.width,focusRect.y + 1);
>> gc.drawLine(focusRect.x,focusRect.y + focusRect.height
>> -1,focusRect.x + focusRect.width,focusRect.y + focusRect.height -1);
>> gc.drawLine(focusRect.x + 1,focusRect.y,focusRect.x +
>> 1,focusRect.y + focusRect.height);
>> gc.drawLine(focusRect.x + focusRect.width
>> -1,focusRect.y,focusRect.x + focusRect.width -1,focusRect.y +
>> focusRect.height);
>> }
>> }
>>
>>
>> }
>>
|
|
|
Re: Grid - DefaultCellRenderer [message #570867 is a reply to message #18938] |
Fri, 01 December 2006 16:27 |
Chris Gross Messages: 471 Registered: July 2009 |
Senior Member |
|
|
The two if's are different. Its isCellFocus and isFocus and they are
different. isCellFocus returns whether the cell is the focused cell
within the grid. isFocus returns whether the grid is the focused widget.
As to what you're trying to do, thats currently not possible. The row
height is determined by the cell renderer, but it is only done once when
the first row is created. You cannot dynamically change the row height.
You can add a bugzilla issue for that feature if its important to you.
Regards,
-Chris
Naren wrote:
> Chris,
>
> I noticed this code from defaultcellrenderer while I was trying to do
> custom cell renderer, looks like a mistake to me
>
> method -- paint -- notice the cellfocus section -- why 2 ifs
>
> if (isCellFocus) {
> .........
> }
> else if (isCellFocus) {
> .................
> }
>
> Anyways, my objective is to decrease the cell ht , when the shell ht is
> decreased, iam trying to decrease the font ht when the shell ht is
> decreased.
>
> Thanks
>
> Naren
>
>
> -------------------------------------------
> public void paint(GC gc, Object value) {
>
> .............
>
> if (isCellFocus())
> {
> Rectangle focusRect = new Rectangle(getBounds().x -1,
> getBounds().y - 1, getBounds().width,
> getBounds().height + 1);
>
> gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_ FOREGROUND));
> gc.drawRectangle(focusRect);
> if (isFocus())
> {
> focusRect.x ++;
> focusRect.width -= 2;
> focusRect.y ++;
> focusRect.height -= 2;
> gc.drawRectangle(focusRect);
> }
> }
> else if (isCellFocus())
> {
> Rectangle focusRect = new Rectangle(getBounds().x -1,
> getBounds().y - 1, getBounds().width,
> getBounds().height + 1);
>
> gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGE T_DARK_SHADOW));
>
>
> gc.drawLine(focusRect.x,focusRect.y,focusRect.x +
> focusRect.width,focusRect.y);
> gc.drawLine(focusRect.x,focusRect.y +
> focusRect.height,focusRect.x + focusRect.width,focusRect.y +
> focusRect.height);
> gc.drawLine(focusRect.x,focusRect.y,focusRect.x,focusRect.y +
> focusRect.height);
> gc.drawLine(focusRect.x +
> focusRect.width,focusRect.y,focusRect.x + focusRect.width,focusRect.y +
> focusRect.height);
> if (isFocus())
> {
> gc.drawLine(focusRect.x,focusRect.y + 1,focusRect.x +
> focusRect.width,focusRect.y + 1);
> gc.drawLine(focusRect.x,focusRect.y + focusRect.height
> -1,focusRect.x + focusRect.width,focusRect.y + focusRect.height -1);
> gc.drawLine(focusRect.x + 1,focusRect.y,focusRect.x +
> 1,focusRect.y + focusRect.height);
> gc.drawLine(focusRect.x + focusRect.width
> -1,focusRect.y,focusRect.x + focusRect.width -1,focusRect.y +
> focusRect.height);
> }
> }
>
>
> }
>
|
|
|
Re: Grid - DefaultCellRenderer [message #570997 is a reply to message #18962] |
Fri, 01 December 2006 17:49 |
Naren Messages: 8 Registered: July 2009 |
Junior Member |
|
|
I found that the hard way. computeRowHeight does that. only when first row
is created.
I tried the similar thing with SWT - Table, font ht works there except
that it does not many other features
we are looking for a
table with no scroll bars
customizable cells
different cell borders / colors
multiple colors in cells
multiple fonts in cells
resize table when the shell is resized
fixed columns widths
resize cell ht when shell is resized
I was able to do most of the requirements except resize Heights. Looks
like that I need to work towards a CUSTOM table.
Thanks
Naren
Chris Gross wrote:
> The two if's are different. Its isCellFocus and isFocus and they are
> different. isCellFocus returns whether the cell is the focused cell
> within the grid. isFocus returns whether the grid is the focused widget.
> As to what you're trying to do, thats currently not possible. The row
> height is determined by the cell renderer, but it is only done once when
> the first row is created. You cannot dynamically change the row height.
> You can add a bugzilla issue for that feature if its important to you.
> Regards,
> -Chris
> Naren wrote:
>> Chris,
>>
>> I noticed this code from defaultcellrenderer while I was trying to do
>> custom cell renderer, looks like a mistake to me
>>
>> method -- paint -- notice the cellfocus section -- why 2 ifs
>>
>> if (isCellFocus) {
>> .........
>> }
>> else if (isCellFocus) {
>> .................
>> }
>>
>> Anyways, my objective is to decrease the cell ht , when the shell ht is
>> decreased, iam trying to decrease the font ht when the shell ht is
>> decreased.
>>
>> Thanks
>>
>> Naren
>>
>>
>> -------------------------------------------
>> public void paint(GC gc, Object value) {
>>
>> .............
>>
>> if (isCellFocus())
>> {
>> Rectangle focusRect = new Rectangle(getBounds().x -1,
>> getBounds().y - 1, getBounds().width,
>> getBounds().height + 1);
>>
>> gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_ FOREGROUND));
>> gc.drawRectangle(focusRect);
>> if (isFocus())
>> {
>> focusRect.x ++;
>> focusRect.width -= 2;
>> focusRect.y ++;
>> focusRect.height -= 2;
>> gc.drawRectangle(focusRect);
>> }
>> }
>> else if (isCellFocus())
>> {
>> Rectangle focusRect = new Rectangle(getBounds().x -1,
>> getBounds().y - 1, getBounds().width,
>> getBounds().height + 1);
>>
>>
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGE T_DARK_SHADOW));
>>
>>
>> gc.drawLine(focusRect.x,focusRect.y,focusRect.x +
>> focusRect.width,focusRect.y);
>> gc.drawLine(focusRect.x,focusRect.y +
>> focusRect.height,focusRect.x + focusRect.width,focusRect.y +
>> focusRect.height);
>> gc.drawLine(focusRect.x,focusRect.y,focusRect.x,focusRect.y +
>> focusRect.height);
>> gc.drawLine(focusRect.x +
>> focusRect.width,focusRect.y,focusRect.x + focusRect.width,focusRect.y +
>> focusRect.height);
>> if (isFocus())
>> {
>> gc.drawLine(focusRect.x,focusRect.y + 1,focusRect.x +
>> focusRect.width,focusRect.y + 1);
>> gc.drawLine(focusRect.x,focusRect.y + focusRect.height
>> -1,focusRect.x + focusRect.width,focusRect.y + focusRect.height -1);
>> gc.drawLine(focusRect.x + 1,focusRect.y,focusRect.x +
>> 1,focusRect.y + focusRect.height);
>> gc.drawLine(focusRect.x + focusRect.width
>> -1,focusRect.y,focusRect.x + focusRect.width -1,focusRect.y +
>> focusRect.height);
>> }
>> }
>>
>>
>> }
>>
|
|
|
Goto Forum:
Current Time: Fri Dec 13 17:27:31 GMT 2024
Powered by FUDForum. Page generated in 0.03572 seconds
|