problem with GridData

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Dmitry
Newbie
Newbie
Posts: 54
Joined: Mon Jul 27, 2009 12:00 am
Contact:

problem with GridData

Post by Dmitry » Mon Jan 14, 2013 1:01 pm

chart = new TChart(parent, SWT.BORDER);
chart.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

Caused by: java.lang.ClassCastException: org.eclipse.swt.layout.GridData cannot be cast to org.eclipse.swt.layout.FillData
at org.eclipse.swt.layout.FillLayout.computeChildSize(Unknown Source)
at org.eclipse.swt.layout.FillLayout.computeSize(Unknown Source)


How does position change? Now chart has central position.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with GridData

Post by Yeray » Wed Jan 16, 2013 11:40 am

Hi Dimitry,

You could achieve it playing with the Layout. Here you have an example:

Code: Select all

		RowLayout rowLayout = new RowLayout();
		rowLayout.wrap = false;
		rowLayout.pack = false;
		rowLayout.justify = true;
		rowLayout.type = SWT.VERTICAL;
		rowLayout.marginLeft = 50;
		rowLayout.marginTop = 0;
		rowLayout.marginRight = 0;
		rowLayout.marginBottom = 0;
		rowLayout.spacing = 0;
		shell.setLayout(rowLayout);
		tChart1.setLayoutData(new RowData(500, 300));
I'd suggest you to read this article about the Layouts in SWT:
http://www.eclipse.org/articles/article ... index.html
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dmitry
Newbie
Newbie
Posts: 54
Joined: Mon Jul 27, 2009 12:00 am
Contact:

Re: problem with GridData

Post by Dmitry » Thu Jan 17, 2013 9:56 am

I made parent Composite and set inside it chart

chart = new TChart(parent, SWT.BORDER);
chart.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING ));
FILL_BOTH is working but .VERTICAL_ALIGN_BEGINNING is not working

Image

I think you generate composite and set inside it widget( chart ) and I can manage only parent composite
But it's not correctly

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with GridData

Post by Yeray » Thu Jan 17, 2013 5:04 pm

Hi Dimitry,

Could you please arrange a simple example project with just the structure and a blank chart reproducing the problem?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dmitry
Newbie
Newbie
Posts: 54
Joined: Mon Jul 27, 2009 12:00 am
Contact:

Re: problem with GridData

Post by Dmitry » Wed Feb 06, 2013 7:37 am

Sorry for pause.
Repeat. You set chart widget in vertical Center parent composite.

Code: Select all

        protected void createScroll(Composite parent) {
		grpScroll = ShopWidget.createScrollComposite(parent);
		grpScroll.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
		grpMainScroll = ShopWidget.createGroup(grpScroll, 1, SWT.NONE);
		grpScroll.setContent(grpMainScroll);
	}
	
	protected void viewSteema(final Composite parent) {
		ShopWidget.removeComposite(grpChart);

		grpChart = ShopWidget.createGroup(grpMainScroll, 1, SWT.NONE);
		grpChart.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));

		try {
			new ChartTime(grpChart).view();
		} catch (AdsmException e) {
			e.printStackTrace();
		}

		int yy = 40 * countNodes;
		grpScroll.setMinSize(parent.computeSize(SWT.DEFAULT, yy));
		grpMainScroll.layout(true);
	}

	protected Composite viewChart(Composite parent) {
		final Composite grpMain = ShopWidget.createGroup(parent, 1, SWT.NONE);
		createScroll(grpMain);
		viewSteema(grpMain);
		return grpMain;
	}

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with GridData

Post by Yeray » Thu Feb 07, 2013 9:23 am

Hi Dimitry,

I'm afraid there are too many objects and classes in your code I don't know where they come from.
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Dmitry
Newbie
Newbie
Posts: 54
Joined: Mon Jul 27, 2009 12:00 am
Contact:

Re: problem with GridData

Post by Dmitry » Sun Feb 10, 2013 7:04 pm

try so and look at result

Code: Select all

	protected Composite viewChart(final Composite parent) {
		final Composite grpMain = ShopWidget.createGroup(parent, 1, SWT.NONE);
				
		ScrolledComposite grpScroll = new ScrolledComposite(grpMain, SWT.NONE | SWT.V_SCROLL | SWT.H_SCROLL); // standard SWT scroll composite
		grpScroll.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));
		grpScroll.setExpandHorizontal(true);
		grpScroll.setExpandVertical(true);				
		Composite grpMainScroll = ShopWidget.createGroup(grpScroll, 1, SWT.NONE); // composite inside scroll composite
		grpScroll.setContent(grpMainScroll);
	
	
                viewSteemaChart(grpMainScroll); // abstract function for call any steema chart  with paretn composite grpMainScroll
				
		grpScroll.setMinSize(grpMain.computeSize(SWT.DEFAULT, 6000));
		grpMainScroll.layout(true)
		return grpMain;
	}

Dmitry
Newbie
Newbie
Posts: 54
Joined: Mon Jul 27, 2009 12:00 am
Contact:

Re: problem with GridData

Post by Dmitry » Sun Feb 10, 2013 7:16 pm

Yeray, And let's using email.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with GridData

Post by Yeray » Tue Feb 12, 2013 11:57 am

Hi Dimitry,

I'm afraid I can't still build this here. Please, try to arrange a simple example project and attach it here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply