Commit 3d24cb90 authored by ics's avatar ics

Bug fixed: When an user drags and drops a forloop at the beginning or in

the middle of the launch pad, other clients crashed.
parent 45fe2cce
* Add token stuff in ploty2
4.0.46 dd/mm/2020
------
* Licence was missing in some files.
* Fix bug: jar from NomadGUISpecialModules were saved in home directory instead of tmp.
* Code method addNewScanCommandBox in CommandZoneSynchronizer.
* Add token stuff in ploty2.
* Fix bug: when an user drags and drops a forloop at the beginning or in the middle of the launch pad, other clients crashed.
* (ClassCastException: GridData cannot be cast to FormData). extraTitleLabel layoutdata was set too late (in init method).
* Now layoutdata for extraTitleLabel is set in the constructor SWTCommandBoxPeer.
4.0.45 08/07/2020
------
......
......@@ -225,6 +225,11 @@ public class SWTCommandBoxPeer extends CommandBoxPeer {
extraLabel = SWTPWidgetFactory.getInstance().createSimpleLabel(container, getExtraLabelTextKey(), FontFactory.standardFontDataHeight, FontFactory.STANDARD_STYLE);
((SWTSimpleLabel)extraLabel).getLabel().setForeground(SWTColorFactory.getGoldColor());
((SWTSimpleLabel)extraLabel).getLabel().setBackground(getTitleColor());
FormData formData = new FormData();
formData.top = new FormAttachment(controllerImageCanvas, 0, SWT.CENTER);
formData.left = new FormAttachment(titleLabel, Magnifier.getScaledValue(Constants.TITLE_SPACING_X) * 2);
((SWTSimpleLabel)extraLabel).getLabel().setLayoutData(formData);
Magnifier.getInstance().addWidgetMagnifyListener(extraLabel);
}
// Create execution tool bar (i.e. background / parallel / stop / delete buttons)
......@@ -344,15 +349,6 @@ public class SWTCommandBoxPeer extends CommandBoxPeer {
titleLabel.setLayoutData(formData);
setTitleAreaCompositeLayoutData();
if (addExtraLabelInTitle()) {
formData = new FormData();
formData.top = new FormAttachment(controllerImageCanvas, 0, SWT.CENTER);
formData.left = new FormAttachment(titleLabel, Magnifier.getScaledValue(Constants.TITLE_SPACING_X) * 2);
((SWTSimpleLabel)extraLabel).getLabel().setLayoutData(formData);
Magnifier.getInstance().addWidgetMagnifyListener(extraLabel);
}
if (commandBox.needsToolBarParentContainer()) {
// Toolbar content
toolBarCompositeFormData = new FormData();
......
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package fr.ill.ics.client.view.test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import fr.ill.ics.client.view.factory.swt.SWTWidgetFactory;
public class TestNullLayoutData {
private Composite mainComposite;
public static void main(String[] args) {
TestNullLayoutData me = new TestNullLayoutData();
me.run();
}
private void run() {
Display display = new Display();
Shell mainShell = new Shell(display);
mainShell.setLayout(new FillLayout());
mainShell = SWTWidgetFactory.getInstance().createShell(SWT.SHELL_TRIM | SWT.BORDER);
mainShell.setLayout(SWTWidgetFactory.getInstance().getMasterGridLayout());
mainComposite = new Composite(mainShell, SWT.COLOR_WIDGET_BORDER);
mainComposite.setLayout(new FormLayout());
Text text = new Text(mainComposite, SWT.NONE);
text.setLayoutData(new GridData());
mainComposite.layout(true, true);
mainShell.pack();
mainShell.open();
while (!mainShell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Useful to debug crash of type: GridData cannot be cast to FormData
* @param composite
*/
private static void debug(Composite composite) {
for (Control control : composite.getChildren()) {
if (control instanceof Composite) {
Composite sub = (Composite)control;
String name = "";
if (sub.getData("name") != null) {
name = (String)sub.getData("name");
}
System.out.println("control is a composite: " + name );
System.out.println(" layout " + sub.getLayout());
System.out.println(" data " + sub.getLayoutData() + " for " + composite.getLayout());
debug(sub);
} else {
System.out.println("control is NOT a composite:");
if (control.getLayoutData() != null) {
if (composite.getLayout() != null) {
if (control.getLayoutData() instanceof GridData && composite.getLayout() instanceof FormLayout) {
System.out.println("STOP !!!!!!!");
}
}
}
System.out.println(" data " + control.getLayoutData() + " for " + composite.getLayout());
}
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment