Commit 083508a9 authored by helene ortiz's avatar helene ortiz
Browse files

Change default GridData for PRadio from NoGrab one to grabbing one:

"rétro-pedalage" => add attribute grabHorizontal for WidgetDescriptor
instead (for the moment, only used for radio widget)
parent 12e75e9c
......@@ -6,9 +6,11 @@
* Move method writeToClipboard() in Nomad class.
* Improve dynamic interface motor for checkbox widget: take font size and style into account.
* Add properties and icon for 3d parameters.
* Change default GridData for PRadio from NoGrab one to grabbing one.
* Add background color attribute to group, table_composite, switchable_composite, dynamic_composite and composite.
* Add a label to display launch pad's remaining time in GUI.
* Change default GridData for PRadio from NoGrab one to grabbing one: "rétro-pedalage" => add attribute grabHorizontal for WidgetDescriptor instead
(for the moment, only used for radio widget)
4.0.135 04/03/2022
-------
......
......@@ -565,6 +565,7 @@ public class ControllerViewParser extends GenericParser {
widgetDescriptor.setFontSize(getAttribute(attributes, ATTRIBUTE_FONT_SIZE));
widgetDescriptor.setFontStyle(getAttribute(attributes, ATTRIBUTE_FONT_STYLE));
widgetDescriptor.setHorizontalSpan(getAttribute(attributes, ATTRIBUTE_HORIZONTAL_SPAN));
widgetDescriptor.setGrabHorizontal(getAttribute(attributes, ATTRIBUTE_GRAB_HORIZONTAL));
if (attributeIsPresent(attributes, ATTRIBUTE_HORIZONTAL_ALIGNMENT)) {
widgetDescriptor.setHorizontalAlignment(getAttribute(attributes, ATTRIBUTE_HORIZONTAL_ALIGNMENT));
} else {
......
......@@ -28,7 +28,9 @@ public abstract class AbstractDescriptor {
protected boolean isVertical = false;
private String switcherKey;
protected String key; // used for widgets which need extra code
protected boolean grabHorizontal = false;
protected String role;
protected int height = 0;
protected int width = 0;
......@@ -235,10 +237,26 @@ public abstract class AbstractDescriptor {
this.inTableComposite = inTableComposite;
}
public void setGrabHorizontal(String grabHorizontal) {
if (grabHorizontal != null && !grabHorizontal.equals("")) {
this.grabHorizontal = (grabHorizontal.equals("true"));
}
}
public void setGrabHorizontal(boolean grabHorizontal) {
this.grabHorizontal = grabHorizontal;
}
public boolean grabHorizontal() {
return grabHorizontal;
}
public String toString() {
return "AbstractDescriptor";
}
public abstract boolean isComposite();
public abstract boolean isNewLine();
protected abstract AbstractDescriptor clone(String allRole, String realRole);
......
......@@ -87,7 +87,6 @@ public class CompositeDescriptor extends AbstractDescriptor {
private List<AbstractDescriptor> contents = new ArrayList<AbstractDescriptor>();
private Set<String> phases;
private boolean grabHorizontal = false;
private boolean containsNewLine = false;
private boolean hiddenOnes = false;
......@@ -484,21 +483,6 @@ public class CompositeDescriptor extends AbstractDescriptor {
return false;
}
public void setGrabHorizontal(String grabHorizontal) {
if (grabHorizontal != null && !grabHorizontal.equals("")) {
this.grabHorizontal = (grabHorizontal.equals("true"));
}
}
public void setGrabHorizontal(boolean grabHorizontal) {
this.grabHorizontal = grabHorizontal;
}
public boolean grabHorizontal() {
return grabHorizontal;
}
public void containsNewLine(boolean containsNewLine) {
this.containsNewLine = containsNewLine;
}
......
......@@ -378,6 +378,7 @@ public class WidgetDescriptor extends AbstractDescriptor {
clonedDescriptor.setSortOnLabels(sortOnLabels+"");
clonedDescriptor.setSelectorType(selectorType);
clonedDescriptor.setChangeDirectory(changeDirectory);
clonedDescriptor.setGrabHorizontal(grabHorizontal);
return clonedDescriptor;
}
......@@ -412,7 +413,8 @@ public class WidgetDescriptor extends AbstractDescriptor {
clonedDescriptor.setStatusValuesAndSizes(statusValuesAndSizes);
clonedDescriptor.setSortOnLabels(sortOnLabels+"");
clonedDescriptor.setSelectorType(selectorType);
clonedDescriptor.setGrabHorizontal(grabHorizontal);
if (data != null) {
clonedDescriptor.setData(new ArrayList<String>(data));
}
......
......@@ -871,7 +871,7 @@ public class SWTCommandBoxPeer extends CommandBoxPeer {
// Temporaire... debuggage suite crash in4 du 3 nov 2015
String content = "SWTCommandBoxPeer.refreshContent: commandContentComposite is disposed for " + commandBox.getName() + "\n";
String fileName = ConfigManager.getInstance().getString("logsDirectory") + ConfigManager.FILE_SEPARATOR + "bug_" + Nomad.getDateAndTime() + ".txt";
Nomad.generateCrashFile(fileName, content);
Nomad.writeToFile(fileName, content);
} else {
commandContentComposite.layout(true, true);
}
......
......@@ -585,7 +585,12 @@ public class SWTPWidgetFactory extends PWidgetFactory {
Composite radioComposite = SWTWidgetFactory.getInstance().createComposite(composite, SWT.NONE);
radioComposite.setLayout(SWTWidgetFactory.getInstance().getNoMarginsGridLayout(1));
GridData gridData = SWTWidgetFactory.getInstance().getGridData();
GridData gridData = SWTWidgetFactory.getInstance().getNoGrabGridData();
if (widgetDescriptor.grabHorizontal()) {
gridData = SWTWidgetFactory.getInstance().getGridData();
gridData.verticalAlignment = SWT.CENTER;
gridData.grabExcessVerticalSpace = true;
}
radioComposite.setLayoutData(gridData);
radioComposite.setData("radioButtonCount", Integer.valueOf(0));
......
......@@ -40,6 +40,10 @@ import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -1057,7 +1061,7 @@ public abstract class Nomad {
}
public static void generateCrashFile(String absoluteFileName, String content) {
public static void writeToFile(String absoluteFileName, String content) {
BufferedWriter writer;
try {
writer = initFile(absoluteFileName);
......@@ -1361,4 +1365,18 @@ public abstract class Nomad {
}
return (mode == UserConnection.MODE_REAL);
}
public static void deleteFile(String path) {
try {
Files.delete(Paths.get(path));
} catch (NoSuchFileException x) {
System.err.format("%s: no such" + " file or directory%n", path);
} catch (DirectoryNotEmptyException x) {
System.err.format("%s not empty%n", path);
} catch (IOException x) {
// File permission problems are caught here.
System.err.println(x);
}
}
}
\ No newline at end of file
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