Is my Styling approach correct. [message #1059086] |
Thu, 16 May 2013 11:18  |
Eclipse User |
|
|
|
What i did for being independent from labeling for styling purpose.
1) Extended TextPainter and overridden painCell() method. as shown below
@Override
public void paintCell(ILayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) {
configureRegistry(cell, configRegistry); //METHOD USED FOR CUSTOM STYLING. ANY ONE CAN EXTEND THIS CLASS AND OVERRIDE THIS METHOD FOR THE CUSTOM STYLING.
super.paintCell(cell, gc, rectangle, configRegistry);
}
protected void configureRegistry(ILayerCell cell, IConfigRegistry configRegistry) {}
2) Applying custom styling to configRegistry.
3) Now anyone can apply custom styling by just extending this class.
Please let me know modification to configRegistry in this way will not cause any problem.
Thanks a lot in advance please must reply.
|
|
|
|
Re: Is my Styling approach correct. [message #1059548 is a reply to message #1059169] |
Mon, 20 May 2013 08:04   |
Eclipse User |
|
|
|
Thank you very much Dirk.
I am using concept of labeling for Styling. Only thing which is causing confusion is that I want to show a painter with a color image.
And I am getting the color by converting cell value and setting wrapped painter as shown below.
@Override
public void paintCell(ILayerCell cell, GC gc, Rectangle rectangle,
IConfigRegistry configRegistry) {
Color colorValue = BeansUtilManager.decodeColorFromInteger(new Integer(cell.getDataValue().toString()));
ColorImage colorImage = new ColorImage(PREFERRED_WIDTH,PREFERRED_HEIGHT, colorValue);
if (image != null && !image.isDisposed()) {
image.dispose();
image = null;
}
image = colorImage.getImage();
setWrappedPainter(new BeveledBorderDecorator(new ImagePainter(image)));
super.paintCell(cell, gc, rectangle, configRegistry);
}
Is above changes are valid(Actually it is fulfilling our requirement). Please share your opinion.
Thanks in advance Dirk Sir, I know you will answer me
[Updated on: Tue, 21 May 2013 05:00] by Moderator
|
|
|
|
Re: Is my Styling approach correct. [message #1059654 is a reply to message #1059570] |
Tue, 21 May 2013 02:23  |
Eclipse User |
|
|
|
Hello Dirk,
After doing the same as suggested above. My painter which is being display in cell with no text(bcoz i overridden the gettexttodisplay() and returned empty string) but image is only Right or Left aligned but i want it in center. with button like look lifted upward. It is working fine for others painters where image is right aligned and lifted up as button kind look.
CellPainterDecorator cpw = new CellPainterDecorator(new TextPainter(),
CellEdgeEnum.LEFT,
new BeveledBorderDecorator(new ImagePainter(){
@Override
protected Image getImage(ILayerCell cell,
IConfigRegistry configRegistry) {
//RETURNING IMAGE FROM HERE},true));
setWrappedPainter(cpw);
Please suggest some appropriate solution or any other approach to get this output.
Thanks
Amresh
[Updated on: Wed, 22 May 2013 10:24] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.28639 seconds