Commit 9adc4c4e authored by Andrey Filippov's avatar Andrey Filippov

Added possibility to insert horizontal separators to the configuration

dialogs, updated documentation
parent 35b57a4b
......@@ -65,6 +65,7 @@ public class XMLConfig extends Config {
static final String PARAMGROUP_NAME_ATTR = "name";
static final String PARAMGROUP_LABEL_ATTR = "label";
static final String PARAMGROUP_VISIBLE_ATTR = "visible";
public static final String PARAMGROUP_SEPARATOR = "---";
static final String PARAMETER_TAG = "parameter";
......
......@@ -28,6 +28,7 @@ import java.util.List;
import com.elphel.vdt.core.tools.config.Config;
import com.elphel.vdt.core.tools.config.ConfigException;
import com.elphel.vdt.core.tools.config.xml.XMLConfig;
import com.elphel.vdt.core.tools.params.*;
import com.elphel.vdt.core.tools.params.recognizers.*;
import com.elphel.vdt.core.tools.params.types.ParamTypeString;
......@@ -224,14 +225,14 @@ public abstract class Context {
timeout=Integer.parseInt(sTimeout);
} catch(Exception e){
}
prompt=commandLinesBlock.parseCntrl(prompt); // replace control character codes (\n,\t,\x)
prompt=CommandLinesBlock.parseCntrl(prompt); // replace control character codes (\n,\t,\x)
prompt=commandLinesBlock.applyMark(prompt); // remove mark sequence
String interrupt=commandLinesBlock.getInterrupt();
List<String> lines = commandLinesBlock.getLines(); // [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String]
if ((lines.size()==0) && commandLinesBlock.hadStrings()){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("Removing command lines block by false condition");
continue; // to enable conditionals for the command line blocks, still making possible to use emty blocks for no-arguments programs
continue; // to enable conditionals for the command line blocks, still making possible to use empty blocks for no-arguments programs
}
List<List<String>> commandSequence = new ArrayList<List<String>>();
for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) {
......@@ -386,6 +387,8 @@ public abstract class Context {
continue;
for(String id : paramIDs) {
if (id.equals(XMLConfig.PARAMGROUP_SEPARATOR)) // Will try to add separator to the dialog
continue;
if(findParam(id) == null)
throw new ConfigException("Parameter '" + id +
"' in context '" + name +
......
......@@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import com.elphel.vdt.core.tools.config.xml.XMLConfig;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.params.ParamGroup;
import com.elphel.vdt.core.tools.params.Parameter;
......@@ -48,6 +49,7 @@ import com.elphel.vdt.ui.options.component.DirComponent;
import com.elphel.vdt.ui.options.component.DirListComponent;
import com.elphel.vdt.ui.options.component.FileComponent;
import com.elphel.vdt.ui.options.component.FileListComponent;
import com.elphel.vdt.ui.options.component.LabelComponent;
import com.elphel.vdt.ui.options.component.NumberComponent;
import com.elphel.vdt.ui.options.component.StringListComponent;
import com.elphel.vdt.ui.options.component.TextComponent;
......@@ -96,7 +98,8 @@ public class OptionsBlock {
ParamGroup paramGroups[] = getParamGroups();
tabComposites = new Composite[paramGroups.length];
scrolledComposite = new ScrolledComposite[paramGroups.length];
if (paramGroups.length==0)
return;
if (paramGroups.length > 1)
createTabFolder(parent, paramGroups);
else
......@@ -172,11 +175,21 @@ public class OptionsBlock {
} // createTabFolders()
protected Component createComponent(Parameter param) {
Component component = null;
ParamType paramType = (param==null)?null:param.getType();
if (param == null) {
component = new LabelComponent(param);
} else if (paramType instanceof ParamTypeNumber) {
component = new NumberComponent(param);
/*
Component component = null;
ParamType paramType = param.getType();
if (paramType instanceof ParamTypeNumber) {
component = new NumberComponent(param);
component = new NumberComponent(param);
*/
} else if (paramType instanceof ParamTypeBool) {
component = new BoolComponent(param);
} else if (paramType instanceof ParamTypeString) {
......@@ -194,8 +207,9 @@ public class OptionsBlock {
} else {
System.out.println("Param type " + param.getType().getName() + " unknown (not implemented?)");
}
components.put(param, component);
if (param!=null) { // Andrey
components.put(param, component);
}
return component;
} // createComponent()
......@@ -213,6 +227,30 @@ public class OptionsBlock {
ParamGroup paramGroup = paramGroups[i];
for (Iterator<String> pi = paramGroup.getParams().iterator(); pi.hasNext();) {
String paramID = (String)pi.next();
Component component;
if (paramID.equals(XMLConfig.PARAMGROUP_SEPARATOR)){
component = createComponent(null); // will create horizontal separator?
component.createControl(tabComposites[i]);
continue;
} else {
//
Parameter param = context.findParam(paramID);
if (!param.isVisible())
continue;
component = components.get(param);
if (component == null)
component = createComponent(param);
if (component == null)
continue;
}
activeComponents.add(component);
// component.setPreferenceStore(store);
component.createControl(tabComposites[i]);
component.setChangeListener(changeListener);
/*
String paramID = (String)pi.next();
Parameter param = context.findParam(paramID);
......@@ -229,6 +267,7 @@ public class OptionsBlock {
// component.setPreferenceStore(store);
component.createControl(tabComposites[i]);
component.setChangeListener(changeListener);
*/
}
}
} // addProperties()
......
......@@ -76,8 +76,10 @@ public abstract class Component {
// System.out.println("-- Component.createControl: id= "+param.getID()+"; label= "+param.getLabel());
this.parent = parent;
activated = false;
labelField = createLabel(parent, param.getLabel());
labelField.setMenu(createPopupMenu(labelField.getShell()));
if (param!=null) {// Andrey - to add labels
labelField = createLabel(parent, param.getLabel());
labelField.setMenu(createPopupMenu(labelField.getShell()));
}
}
protected void endCreateControl() {
......@@ -134,27 +136,31 @@ public abstract class Component {
}
public boolean isEnable() {
if (param==null) return true; // label
return ! param.isReadOnly();
}
public void setVisible (boolean visible) {
labelField.setVisible(visible);
if (labelField!=null)
labelField.setVisible(visible);
}
public void setEnabled (boolean enabled) {
labelField.setEnabled(enabled);
if (labelField!=null)
labelField.setEnabled(enabled);
}
protected void setDefault(boolean defaulted) {
// System.out.println("-- Component.setDefault: id= "+param.getID()+"; label= "+param.getLabel());
isDefault = defaulted;
labelField.setForeground(defaulted ? colorForegroundDefault
: colorForeground );
if (labelField!=null)
labelField.setForeground(defaulted ? colorForegroundDefault
: colorForeground );
}
protected void selectionChanged() {
// System.out.println("-- Component.selectionChanged: id= "+param.getID()+"; label= "+param.getLabel());
if (! param.hasDependentParameters())
if ((param == null) || (! param.hasDependentParameters()))
return;
if (changeNotifier == null)
......
......@@ -35,10 +35,12 @@ public abstract class GeneralComponent extends Component {
protected Menu popupMenu;
GeneralComponent(Parameter param) {
super(param);
option = new ParamBasedOption(param);
isDefault = option.isStoredDefault();
modifyListener = createModifyListener();
super(param);
if (param!=null) { //Andrey
option = new ParamBasedOption(param);
isDefault = option.isStoredDefault();
modifyListener = createModifyListener();
}
}
protected void endCreateControl() {
......
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