/** * Sets a value to an input name. The value should be in the following forms: * * <p>For single list field: a string For multiple list fields: strings separated by '; ' For * ranges: an string like 'Start: 0 - Stop: 0 - Step: 0' * * @param inputName * @param value */ public void setInputValue(String inputName, String value) { for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; if (source.getName().equals(inputName)) { source.setValue(value); } } } }
/** * Gets a map of parameters. * * @return Map of parameters */ public Map<String, String> getParametersMap() { Map<String, String> paramsMap = new HashMap<String, String>(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; paramsMap.put(source.getName(), source.getValue()); } } return paramsMap; }
/** @return */ public boolean validate() { boolean valid = simulationNameItem.validate(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; if (!source.validate()) { valid = false; } } } return valid; }
@Override public void attachToCanvas() { // remove all previous members, except crumbs for (int i = 1; i < canvas.getMembers().length; i++) { Canvas m = canvas.getMember(i); canvas.removeMember(m); } if (tabs.getTabs().length == 1) { Canvas c = tabs.getTabs()[0].getPane(); c.setHeight100(); canvas.addMember(c); // add the pane directly } else canvas.addMember(tabs); }
/** * @param simulationName * @param valuesMap */ public void loadInputs(String simulationName, Map<String, String> valuesMap) { this.simulationNameItem.setValue(simulationName); final Map<String, String> conflictMap = new HashMap<String, String>(); StringBuilder sb = new StringBuilder(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { final AbstractSourceLayout source = (AbstractSourceLayout) canvas; final String inputValue = valuesMap.get(source.getName()); if (inputValue != null) { if (source.getValue() == null || source.getValue().isEmpty()) { source.setValue(inputValue); } else { conflictMap.put(source.getName(), inputValue); } } } } if (!conflictMap.isEmpty()) { SC.ask( "The following fields already have a value.<br />" + "Do you want to replace them?<br />" + "Fields: " + conflictMap.keySet(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; source.setValue(conflictMap.get(source.getName())); } } } } }); } if (sb.length() > 0) { Layout.getInstance().setWarningMessage(sb.toString()); } }
public boolean isLoaded() { return (generalContentPanel.getMembers().length > 0) && rulesContentPanel.getMembers().length > 0 && ruleContentPanel.getMembers().length > 0 && (actionContentPanel.getMembers().length > 0); }