Commit a1691a55 authored by helene ortiz's avatar helene ortiz
Browse files

Attribute width added to selector widget

parent a37fc0c3
......@@ -105,7 +105,7 @@ public class ControllerViewParser extends GenericParser {
private final static String TAG_NEW_LINE = "newLine";
private final static String TAG_STYLE = "style";
// Property selector
public final static String TAG_SELECTOR = "selector";
......@@ -168,26 +168,26 @@ public class ControllerViewParser extends GenericParser {
private final static String ATTRIBUTE_SWITCH_VALUES = "switch_values";
public final static String ATTRIBUTE_SWITCHER_TYPE = "switcher_type";
private final static String ATTRIBUTE_INITIAL_VALUE = "initial_value";
// For changing color label
private final static String ATTRIBUTE_STATUS_PROPERTY = "status_property";
private final static String ATTRIBUTE_STATUS_VALUES_AND_STYLES = "statusValuesAndStyles";
private final static String ATTRIBUTE_STATUS_VALUES_AND_SIZES = "statusValuesAndSizes";
// 64:CHANGING|0,4,8,12,16:WARNING|*:BOLD
public static String STATUS_VALUES_AND_STYLES_SEPARATOR_LEVEL_1 = "|";
public static String STATUS_VALUES_AND_STYLES_SEPARATOR_LEVEL_2 = ":";
public static String STATUS_VALUES_AND_STYLES_SEPARATOR_LEVEL_3 = ",";
// For tag "file_text"
private final static String ATTRIBUTE_EXTENSIONS = "extensions";
private final static String ATTRIBUTE_STARTING_DIRECTORY = "starting_directory";
private final static String ATTRIBUTE_CHANGE_DIRECTORY = "change_directory";
// For property_combo
private final static String ATTRIBUTE_SYNCHRO = "synchro";
// For selector
private final static String ATTRIBUTE_SELECTOR_TYPE = "selector_type";
......@@ -212,7 +212,7 @@ public class ControllerViewParser extends GenericParser {
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if (qName.equals(TAG_PLUGIN)) {
mainCompositeDescriptor = new CompositeDescriptor(null);
compositeDescriptor = mainCompositeDescriptor;
......@@ -261,9 +261,9 @@ public class ControllerViewParser extends GenericParser {
} else if (qName.equals(TAG_DYNAMIC_COMPOSITE)) {
// The new CompositeDescriptor instance is a child of the current one
compositeDescriptor = new CompositeDescriptor(compositeDescriptor, TAG_DYNAMIC_COMPOSITE);
setCompositeAttributes(attributes);
// H.ORTIZ 07 MAY 2015: isVertical is now available for dynamic_composite (by default they are vertical UNLIKE OTHERS CONTAINERS !)
if (attributeIsPresent(attributes, ATTRIBUTE_VERTICAL)) {
compositeDescriptor.setVertical(getAttribute(attributes, ATTRIBUTE_VERTICAL));
......@@ -271,10 +271,10 @@ public class ControllerViewParser extends GenericParser {
// H.ORTIZ 07 MAY 2015: isVertical is now available for dynamic_composite (by default they are vertical UNLIKE OTHERS CONTAINERS !)
compositeDescriptor.setVertical("true");
}
compositeDescriptor.setRole(getAttribute(attributes, ATTRIBUTE_ROLE));
compositeDescriptor.setProperties(getAttribute(attributes, ATTRIBUTE_PROPERTIES));
if (attributeIsPresent(attributes, ATTRIBUTE_IGNORE)) {
compositeDescriptor.setMissingPropertiesToIgnore(getAttribute(attributes, ATTRIBUTE_IGNORE));
}
......@@ -285,7 +285,7 @@ public class ControllerViewParser extends GenericParser {
compositeDescriptor.setBorderVisible(getAttribute(attributes, ATTRIBUTE_BORDER));
} else if (qName.equals(TAG_POSITIONNABLE_COMPOSITE)) {
// The new CompositeDescriptor instance is a child of the current one
compositeDescriptor = new CompositeDescriptor(compositeDescriptor, TAG_POSITIONNABLE_COMPOSITE);
setCompositeAttributes(attributes);
......@@ -307,7 +307,7 @@ public class ControllerViewParser extends GenericParser {
} else {
// H.ORTIZ 02 MAY 2016: This used to be considered as an error but must not crash Nomad if missing...
compositeDescriptor.setNbColumns("1");
}
nbTableComposites = nbTableComposites + 1;
......@@ -353,7 +353,7 @@ public class ControllerViewParser extends GenericParser {
widgetDescriptor = new WidgetDescriptor(qName);
widgetDescriptor.setValuesAndLabels(getAttribute(attributes, ATTRIBUTE_VALUES_AND_LABELS));
setWidgetAttributes(attributes);
} else if (qName.equals(TAG_CHANGING_COLOR_LABEL)) {
widgetDescriptor = new WidgetDescriptor(qName);
setWidgetAttributes(attributes);
......@@ -390,12 +390,12 @@ public class ControllerViewParser extends GenericParser {
setWidgetAttributes(attributes);
if (attributeIsPresent(attributes, ATTRIBUTE_SYNCHRO)) {
try {
widgetDescriptor.setSynchro(Boolean.valueOf(getAttribute(attributes, ATTRIBUTE_SYNCHRO)));
widgetDescriptor.setSynchro(Boolean.valueOf(getAttribute(attributes, ATTRIBUTE_SYNCHRO)));
} catch (ClassCastException e) {
widgetDescriptor.setSynchro(false);
}
}
} else if (qName.equals(TAG_RADIO)) {
widgetDescriptor = new WidgetDescriptor(TAG_RADIO);
setWidgetAttributes(attributes);
......@@ -405,7 +405,7 @@ public class ControllerViewParser extends GenericParser {
} else if (qName.equals(TAG_BUTTON)) {
widgetDescriptor = new WidgetDescriptor(TAG_BUTTON);
setWidgetAttributes(attributes);
} else if (qName.equals(TAG_FILE_TEXT)) {
widgetDescriptor = new WidgetDescriptor(TAG_FILE_TEXT);
setWidgetAttributes(attributes);
......@@ -438,7 +438,7 @@ public class ControllerViewParser extends GenericParser {
}
}
setWidgetAttributes(attributes);
} else if (qName.equals(TAG_PLOT_LAUNCHER)) {
widgetDescriptor = new WidgetDescriptor(TAG_PLOT_LAUNCHER);
widgetDescriptor.setHeight(getAttribute(attributes, ATTRIBUTE_HEIGHT));
......@@ -455,7 +455,7 @@ public class ControllerViewParser extends GenericParser {
}
}
setWidgetAttributes(attributes);
} else if (qName.equals(TAG_DYNAMIC_PLOT)) {
widgetDescriptor = new WidgetDescriptor(TAG_DYNAMIC_PLOT);
widgetDescriptor.setHeight(getAttribute(attributes, ATTRIBUTE_HEIGHT));
......@@ -473,7 +473,7 @@ public class ControllerViewParser extends GenericParser {
}
}
setWidgetAttributes(attributes);
} else if (qName.equals(TAG_DYNAMIC_PLOT_LAUNCHER)) {
widgetDescriptor = new WidgetDescriptor(TAG_DYNAMIC_PLOT_LAUNCHER);
widgetDescriptor.setHeight(getAttribute(attributes, ATTRIBUTE_HEIGHT));
......@@ -519,6 +519,9 @@ public class ControllerViewParser extends GenericParser {
} else if (qName.equals(TAG_SELECTOR)) {
widgetDescriptor = new WidgetDescriptor(TAG_SELECTOR);
setWidgetAttributes(attributes);
if (attributeIsPresent(attributes, ATTRIBUTE_WIDTH)) {
widgetDescriptor.setWidth(getAttribute(attributes, ATTRIBUTE_WIDTH));
}
} else if (qName.equals(ControllerConfigParser.TAG_CONTROLLER) || qName.equals(ControllerConfigParser.TAG_PROPERTY) || qName.equals(ControllerConfigParser.TAG_DYNAMIC_PROPERTY)) {
// just to avoid a warning
......@@ -657,7 +660,7 @@ public class ControllerViewParser extends GenericParser {
private void writeComposite(CompositeDescriptor compositeDescriptor, boolean commandFile) {
fileContent = fileContent + "<" + TAG_PLUGIN + ">" + GenericParser.LINE_SEPARATOR;
if (commandFile) {
fileContent = fileContent + "\t<" + ControllerCommandViewParser.TAG_NUMBER_OF_LINES + " " + ControllerCommandViewParser.ATTRIBUTE_NUMBER_OF_LINES + "=\"10\"/>\n";
}
......@@ -671,12 +674,12 @@ public class ControllerViewParser extends GenericParser {
fileContent = fileContent + "\t<" + ControllerConfigParser.TAG_CONTROLLER + " " + ControllerConfigParser.ATTRIBUTE_TYPE + "=\"" + type + "\" " + ControllerConfigParser.ATTRIBUTE_ROLE + "=\"" + role + "\"/>" + GenericParser.LINE_SEPARATOR;
}
}
writeComposite(compositeDescriptor, 0);
fileContent = fileContent + GenericParser.LINE_SEPARATOR;
fileContent = fileContent + "</" + TAG_PLUGIN + ">" + GenericParser.LINE_SEPARATOR;
}
private void writeComposite(CompositeDescriptor compositeDescriptor, int level) {
......@@ -771,7 +774,7 @@ public class ControllerViewParser extends GenericParser {
public void setWriter(BufferedWriter writer) {
this.writer = writer;
}
public void setControllers(Map newControllers) {
if (newControllers != null) {
if (controllers == null) {
......
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