Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Manipulate strength and color of table/tree viewer grid?(Looking after the right means to manipulate low level graphical properties of JFace Table/Tree Viewer)
icon5.gif  Manipulate strength and color of table/tree viewer grid? [message #493667] Tue, 27 October 2009 10:13 Go to next message
Eclipse UserFriend
Hi,
I'm creating an application whose User Interface consists mainly of a JFace Tree Viewer in table mode. Now I'm looking after a method to improve the visibility of the table grid. The default grid lines are in a very light grey and rather thin and can be rarely seen when showed by beamer projection.
Is there a smart way to manipulate these properties? Any example snippets out there?
Any help would be heavily appreciated!
Greetings
dagmar
Re: Manipulate strength and color of table/tree viewer grid? [message #493941 is a reply to message #493667] Wed, 28 October 2009 10:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dagmar,

here is an example how to do it.... be careful, this example draws only lines if there is an element.

viewer.addListener(SWT.PaintItem, this);

@Override
public void handleEvent( Event event) {
    switch (event.type) {
    case SWT.PaintItem:
        paintItemBorder(event);
        break;
    }

protected void paintItemBorder( Event event) {
        if (getLinesVisible()) {
            return;
        }

        // Draw line at bottom and right side
        int x1 = event.x;
        int y1 = event.y;

        int x2 = x1 + getColumnWidth(event.index) - 1;
        int y2 = y1 + getItemHeight() - 1;

        GC gc = event.gc;
            gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
        gc.drawLine(x1, y2, x2, y2); //Change line width by manipulating these values
        gc.drawLine(x2, y1, x2, y2);
    }

[Updated on: Wed, 28 October 2009 11:00] by Moderator

icon14.gif  Re: Manipulate strength and color of table/tree viewer grid? [message #494031 is a reply to message #493941] Wed, 28 October 2009 16:42 Go to previous messageGo to next message
Eclipse UserFriend
Thx a lot, I can't try it right now, but it looks good.
yours
dagmar
Re: Manipulate strength and color of table/tree viewer grid? [message #494122 is a reply to message #493941] Thu, 29 October 2009 05:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I just tried to use your snippet but I could not find a class which provides a method named getColumnWidth - Table/TreeViewer don't provide a method like this. Calling the method directly produces an error.
Do I have to extract a column and get the width from the column directly? Or do I have to import anything from which I can call that method?

Thx a lot,
Dagmar
icon10.gif  Re: Manipulate strength and color of table/tree viewer grid? [message #494136 is a reply to message #494122] Thu, 29 October 2009 06:50 Go to previous message
Eclipse UserFriend
Hey Dagmar,

my fault, sorry. The SWT Tree and Table class provide these methods.

so call myTreeViewer.getTree().getItemHeight();

Sorry for missing that.
Greetz
Thomas
Previous Topic:Trouble with threadsafe Databinding
Next Topic:Can not add an eclipse console into RCP app
Goto Forum:
  


Current Time: Tue Jul 01 07:42:21 EDT 2025

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

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

Back to the top