Commit 12e75e9c authored by helene ortiz's avatar helene ortiz
Browse files

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.
parent bf85a382
......@@ -6,6 +6,9 @@
* 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.
4.0.135 04/03/2022
-------
......
......@@ -11,6 +11,7 @@
<item key="menu.view.imageViewer" action="fr.ill.ics.client.view.menu.OpenImageViewerAction" accelerator="w" instruments="gamma34,gamma26,d9,d19,ssci7,thales,gamma15"/>
<item key="menu.view.configurationErrors" action="fr.ill.ics.client.view.menu.ShowConfigurationErrorsAction"/>
<item key="menu.view.logger" action="fr.ill.ics.client.view.menu.OpenLoggerAction"/>
<item key="menu.view.nomad3d" action="fr.ill.ics.client.view.menu.OpenNomad3dAction"/>
</menu>
<menu key="menu.hardware">
<item key="menu.hardware.pause" check="true" action="fr.ill.ics.client.view.menu.HardwarePauseAction" accelerator="p"/>
......
......@@ -279,6 +279,15 @@ public class ExperimentData implements IPropertyChangeListener {
}
return "unknown";
}
public String getInstrumentNameFor3d() {
String instrumentName = getInstrumentName();
return instrumentName.substring(0,1) + instrumentName.substring(1, instrumentName.length()).toLowerCase();
}
public String getInstrumentCode() {
if (instrumentCodeProperty != null) {
......
......@@ -135,6 +135,7 @@ public class ControllerViewParser extends GenericParser {
private final static String ATTRIBUTE_SWITCHER_KEY = "switcher_key";
private final static String ATTRIBUTE_VALUES_IMAGES_AND_LABELS = "valuesImagesAndLabels";
private final static String ATTRIBUTE_BORDER = "border";
private final static String ATTRIBUTE_BACKGROUND_COLOR = "background_color";
private final static String ATTRIBUTE_NB_COLUMNS = "nbColumns";
private final static String ATTRIBUTE_HEIGHT = "height";
private final static String ATTRIBUTE_MANAGE_ALERT = "manageAlert";
......@@ -535,6 +536,7 @@ public class ControllerViewParser extends GenericParser {
compositeDescriptor.setAlignment(getAttribute(attributes, ATTRIBUTE_ALIGNMENT));
compositeDescriptor.setBorderVisible(getAttribute(attributes, ATTRIBUTE_BORDER));
compositeDescriptor.setBackgroundRGB(getAttribute(attributes, ATTRIBUTE_BACKGROUND_COLOR));
compositeDescriptor.setKey(getAttribute(attributes, ATTRIBUTE_KEY));
compositeDescriptor.setMargin(getAttribute(attributes, ATTRIBUTE_MARGIN));
compositeDescriptor.setSpacing(getAttribute(attributes, ATTRIBUTE_SPACING));
......
......@@ -26,8 +26,10 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import fr.ill.ics.client.control.parser.ControllerViewParser;
import fr.ill.ics.client.view.factory.ColorFactory;
public class CompositeDescriptor extends AbstractDescriptor {
......@@ -90,6 +92,8 @@ public class CompositeDescriptor extends AbstractDescriptor {
private boolean hiddenOnes = false;
private int[] backgroundRGB = ColorFactory.getBackgroundRGBAsIntArray();
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// WARNING !!! IF ATTRIBUTES ARE ADDED THINK TO UPDATE CLONE METHODS !!!!!!!!!!!!!!!!!!!!!!
......@@ -382,6 +386,7 @@ public class CompositeDescriptor extends AbstractDescriptor {
clonedDescriptor.setTitle(title);
clonedDescriptor.setX(x);
clonedDescriptor.setY(y);
clonedDescriptor.setBackgroundRGB(getBackgroundRGB());
// iterator over children and clone them
Iterator<AbstractDescriptor> it = getContents().iterator();
......@@ -405,6 +410,7 @@ public class CompositeDescriptor extends AbstractDescriptor {
clonedDescriptor.setNbColumns(nbColumns);
clonedDescriptor.setGrabHorizontal(grabHorizontal);
clonedDescriptor.containsNewLine(containsNewLine);
clonedDescriptor.setBackgroundRGB(getBackgroundRGB());
if (switchValues != null) {
clonedDescriptor.setSwitchValues(new ArrayList<String>(switchValues));
......@@ -510,4 +516,25 @@ public class CompositeDescriptor extends AbstractDescriptor {
public boolean hiddenOnes() {
return hiddenOnes;
}
public void setBackgroundRGB(String backgroundColor) {
if (Pattern.matches("\\d\\d\\d,\\d\\d\\d,\\d\\d\\d", backgroundColor)) {
StringTokenizer tokenizer = new StringTokenizer(backgroundColor, ",");
int red = Integer.valueOf(tokenizer.nextElement().toString());
int green = Integer.valueOf(tokenizer.nextElement().toString());
int blue = Integer.valueOf(tokenizer.nextElement().toString());
this.backgroundRGB = new int[] {red, green, blue};
}
}
public void setBackgroundRGB(int[] backgroundColor) {
this.backgroundRGB = backgroundColor;
}
public int[] getBackgroundRGB() {
return backgroundRGB;
}
}
......@@ -22,7 +22,7 @@ import fr.ill.ics.client.view.factory.swt.SWTColorFactory;
public abstract class ColorFactory {
protected static final int[] background = new int[] {255,255,255}; // #FFFFFF (white)
public static final int[] background = new int[] {255,255,255}; // #FFFFFF (white)
public static final int[] textForeground = new int[] {0,0,0}; // #000000 (black)
protected static final int[] textBackground = new int[] {255,255,255}; // #FFFFFF (white)
public static final int[] nomad = new int[] {31,150,192}; // Nomad blue
......@@ -80,6 +80,22 @@ public abstract class ColorFactory {
}
return instance;
}
/**
* Gets the background RGB as int array according to current display mode
* @return the background RGB as int array
*/
public static int[] getBackgroundRGBAsIntArray() {
if (WidgetFactory.CURRENT_MODE == WidgetFactory.SPY_MODE) {
return spyBackground;
}
if (WidgetFactory.CURRENT_MODE == WidgetFactory.COMMAND_TOOLBAR_MODE) {
return commandBoxTitle;
}
return background;
}
// Command line syntax highlighting
protected static final int[] commandLineDefault = new int[] {0, 0, 0};
......
......@@ -585,7 +585,7 @@ public class SWTPWidgetFactory extends PWidgetFactory {
Composite radioComposite = SWTWidgetFactory.getInstance().createComposite(composite, SWT.NONE);
radioComposite.setLayout(SWTWidgetFactory.getInstance().getNoMarginsGridLayout(1));
GridData gridData = SWTWidgetFactory.getInstance().getNoGrabGridData();
GridData gridData = SWTWidgetFactory.getInstance().getGridData();
radioComposite.setLayoutData(gridData);
radioComposite.setData("radioButtonCount", Integer.valueOf(0));
......
......@@ -55,7 +55,7 @@ public abstract class LoggerWindow implements ICanvasClickListener {
private final static String namePropertyName = ConfigManager.getInstance().getString("MAINTENANCE_NAME_PROPERTY");
private final static String messagePropertyName = ConfigManager.getInstance().getString("MAINTENANCE_MESSAGE_PROPERTY");
private final static String[] members = new String[] {EMPTY_USER, "BLANC-PAQUES Julien","BURILLER Aurélien","CECILLON Franck","COCHO MARTINEZ Cristina","DELPIERRE Jean-Marc","ELAAZZOUZI Ali","LE GOC Yannick","LOCATELLI Jérôme","MARY Thierry","MUTTI Paolo","OLLIVIER Kévin","ORTIZ Hélène","PLATZ Martin","REY Franck","RODRIGUEZ MURIAS Javier","RUIZ MARTINEZ Emilio","SALLAZ-DAMAZ Sylvain","SONG Guanghan","VAN ESCH Patrick", OTHER_USER};
private final static String[] members = new String[] {EMPTY_USER, "BLANC-PAQUES Julien","BURILLER Aurélien","CECILLON Franck","COCHO MARTINEZ Cristina","DELPIERRE Jean-Marc","ELAAZZOUZI Ali","LE GOC Yannick","LOCATELLI Jérôme","MARY Thierry","MUTTI Paolo","OLLIVIER Kévin","ORTIZ Hélène","PICHAT Valérie", "PLATZ Martin","REY Franck","RUIZ MARTINEZ Emilio","SALLAZ-DAMAZ Sylvain","VAN ESCH Patrick", OTHER_USER};
private String errorMessage;
......
/*
* 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.menu;
import java.io.IOException;
import fr.ill.ics.client.control.MainWindow;
import fr.ill.ics.client.control.experiment.ExperimentData;
import fr.ill.ics.client.view.util.dialog.DialogManager;
import fr.ill.ics.common.Nomad;
/**
*
* @author ortizh
*
*/
public class OpenNomad3dAction implements IMenuAction {
private final static String URL_PROD = "sci-vm1:4000?instrument=";
private final static String URL_DEV = "http://localhost:4000?instrument=";
public void execute(boolean checked, int x, int y) {
String url = URL_DEV;
if (Nomad.isProd()) {
url = URL_PROD;
}
if (MainWindow.getInstance().visa()) {
url = url.replaceFirst("https", "visa");
Nomad.writeToClipboard(url);
} else {
try {
Runtime.getRuntime().exec("/usr/bin/chromium -new-window " + url + ExperimentData.getInstance().getInstrumentNameFor3d());
// OK but firefox displays error messages
//Runtime.getRuntime().exec("/usr/bin/firefox -new-window " + url + "?instrument=thales");
} catch (IOException e) {
DialogManager.getInstance().nomadMessageDialog("errorWhileOpeningNomad3dURLMessage", "nomad3dToolTip");
e.printStackTrace();
Nomad.writeToClipboard(url);
}
}
}
}
\ No newline at end of file
......@@ -434,6 +434,7 @@ public abstract class ControllerPluginPeer extends PluginPeer {
} else {
container = createGroupContainer(lineContainer, embeddedCompositeDescriptor.getTitle());
}
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
if (dynamicCompositeCreationInProgress) {
storeContainerForDynamic(container);
......@@ -451,6 +452,8 @@ public abstract class ControllerPluginPeer extends PluginPeer {
style = PWidgetFactory.STYLE_BORDER;
}
container = createFormContainer(lineContainer, style);
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
if (dynamicCompositeCreationInProgress) {
storeContainerForDynamic(container);
}
......@@ -467,6 +470,7 @@ public abstract class ControllerPluginPeer extends PluginPeer {
}
container = createPositionnableContainer(lineContainer, style, embeddedCompositeDescriptor.getX(), embeddedCompositeDescriptor.getY(), embeddedCompositeDescriptor.getWidth(), embeddedCompositeDescriptor.getHeight());
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
if (dynamicCompositeCreationInProgress) {
storeContainerForDynamic(container);
}
......@@ -511,7 +515,7 @@ public abstract class ControllerPluginPeer extends PluginPeer {
}
}
}
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
createCompositeWidgets(container, embeddedCompositeDescriptor);
WidgetFactory.CURRENT_MODE = currentMode;
......@@ -530,6 +534,8 @@ public abstract class ControllerPluginPeer extends PluginPeer {
if (dynamicCompositeCreationInProgress) {
storeContainerForDynamic(container);
}
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
createCompositeWidgets(container, embeddedCompositeDescriptor);
WidgetFactory.CURRENT_MODE = currentMode;
......@@ -559,6 +565,7 @@ public abstract class ControllerPluginPeer extends PluginPeer {
}
container = lineContainer;
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
// First, search for size property
int i = 0;
......@@ -690,6 +697,7 @@ public abstract class ControllerPluginPeer extends PluginPeer {
}
}
}
container.setBackgroundRGB(embeddedCompositeDescriptor.getBackgroundRGB());
if (dynamicCompositeCreationInProgress) {
storeContainerForDynamic(container);
......
......@@ -38,4 +38,5 @@ public interface PContainer {
public boolean grabExcessHorizontalSpace();
public void setColoredBackground(String color);
public void setVerticalSpacing(int verticalSpacing);
public void setBackgroundRGB(int[] backgroundRGB);
}
\ No newline at end of file
......@@ -250,4 +250,8 @@ public class SWTPContainer implements PContainer {
return grabExcessHorizontalSpace;
}
@Override
public void setBackgroundRGB(int[] backgroundRGB) {
composite.setBackground(SWTColorFactory.getColor(SWTColorFactory.createRGB(backgroundRGB[0], backgroundRGB[1], backgroundRGB[2])));
}
}
\ 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