Added ColonSpaceValidator
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@158145 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
892b65f263
commit
6db24afe6c
|
@ -0,0 +1,25 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.custom;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.editor.client.Editor;
|
||||
import com.google.gwt.editor.client.EditorError;
|
||||
import com.sencha.gxt.widget.core.client.form.validator.AbstractValidator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ColonSpaceValidator extends AbstractValidator<String> {
|
||||
|
||||
@Override
|
||||
public List<EditorError> validate(Editor<String> editor, String value) {
|
||||
if (value != null && !value.isEmpty() && value.contains(": ")) {
|
||||
return createError(editor, "Invalid sequence of characters=': '", value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -77,10 +77,10 @@ public class InputVariableTabPanel extends TabPanel {
|
|||
//
|
||||
public void setMainCode(Project project) {
|
||||
try {
|
||||
globalVariablesPanel.update(project);
|
||||
inputOutputVariablesPanel.update(project);
|
||||
projectInfoPanel.update(project);
|
||||
inputOutputVariablesPanel.update(project);
|
||||
interpreterInfoPanel.update(project);
|
||||
globalVariablesPanel.update(project);
|
||||
forceLayout();
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||
|
@ -91,10 +91,10 @@ public class InputVariableTabPanel extends TabPanel {
|
|||
|
||||
public void setBinaryCode(Project project) {
|
||||
try {
|
||||
globalVariablesPanel.update(project);
|
||||
inputOutputVariablesPanel.update(project);
|
||||
projectInfoPanel.update(project);
|
||||
inputOutputVariablesPanel.update(project);
|
||||
interpreterInfoPanel.update(project);
|
||||
globalVariablesPanel.update(project);
|
||||
forceLayout();
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||
|
@ -105,10 +105,10 @@ public class InputVariableTabPanel extends TabPanel {
|
|||
|
||||
public void updateTabs(Project project) {
|
||||
try {
|
||||
globalVariablesPanel.update(project);
|
||||
projectInfoPanel.update(project);
|
||||
inputOutputVariablesPanel.update(project);
|
||||
interpreterInfoPanel.update(project);
|
||||
projectInfoPanel.update(project);
|
||||
globalVariablesPanel.update(project);
|
||||
forceLayout();
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||
|
@ -120,29 +120,30 @@ public class InputVariableTabPanel extends TabPanel {
|
|||
|
||||
InputData inputData = new InputData();
|
||||
|
||||
if (globalVariablesPanel != null) {
|
||||
inputData.setListGlobalVariables(globalVariablesPanel.getGlobalVariables());
|
||||
}
|
||||
|
||||
if (inputOutputVariablesPanel != null) {
|
||||
inputData.setListInputOutputVariables(inputOutputVariablesPanel.getInputOutputVariables());
|
||||
}
|
||||
|
||||
if (interpreterInfoPanel != null) {
|
||||
inputData.setInterpreterInfo(interpreterInfoPanel.getInterpreterInfo());
|
||||
}
|
||||
|
||||
InputReadyEvent inputReadyEvent;
|
||||
|
||||
try {
|
||||
if (projectInfoPanel != null) {
|
||||
ProjectInfo projectInfo = projectInfoPanel.getProjectInfo();
|
||||
inputData.setProjectInfo(projectInfo);
|
||||
inputReadyEvent = new InputReadyEvent(inputData);
|
||||
} else {
|
||||
inputReadyEvent = new InputReadyEvent(inputData, "Error loading ProjectInfoPanel!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.error("Attention invalid project info: " + e.getLocalizedMessage());
|
||||
|
||||
if (inputOutputVariablesPanel != null) {
|
||||
inputData.setListInputOutputVariables(inputOutputVariablesPanel.getInputOutputVariables());
|
||||
}
|
||||
|
||||
if (interpreterInfoPanel != null) {
|
||||
inputData.setInterpreterInfo(interpreterInfoPanel.getInterpreterInfo());
|
||||
}
|
||||
|
||||
if (globalVariablesPanel != null) {
|
||||
inputData.setListGlobalVariables(globalVariablesPanel.getGlobalVariables());
|
||||
}
|
||||
|
||||
inputReadyEvent = new InputReadyEvent(inputData);
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("Attention invalid info: " + e.getLocalizedMessage());
|
||||
inputReadyEvent = new InputReadyEvent(inputData, e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
@ -152,6 +153,15 @@ public class InputVariableTabPanel extends TabPanel {
|
|||
}
|
||||
|
||||
// Add
|
||||
private void addProjectInfoPanel(Project project) {
|
||||
TabItemConfig projectInfoPanelItemConf = new TabItemConfig(msgs.projectInfo(), false);
|
||||
|
||||
projectInfoPanel = new ProjectInfoPanel(project, eventBus);
|
||||
projectInfoPanel.setHeaderVisible(false);
|
||||
add(projectInfoPanel, projectInfoPanelItemConf);
|
||||
|
||||
}
|
||||
|
||||
private void addInputOutputVariablesPanel(Project project) {
|
||||
TabItemConfig inputOutputPanelItemConf = new TabItemConfig(msgs.inputOutputVariables(), false);
|
||||
|
||||
|
@ -178,15 +188,6 @@ public class InputVariableTabPanel extends TabPanel {
|
|||
|
||||
}
|
||||
|
||||
private void addProjectInfoPanel(Project project) {
|
||||
TabItemConfig projectInfoPanelItemConf = new TabItemConfig(msgs.projectInfo(), false);
|
||||
|
||||
projectInfoPanel = new ProjectInfoPanel(project, eventBus);
|
||||
projectInfoPanel.setHeaderVisible(false);
|
||||
add(projectInfoPanel, projectInfoPanelItemConf);
|
||||
|
||||
}
|
||||
|
||||
public void addSelectedRowsVariable(InputOutputVariables inputOutputVariable) {
|
||||
setActiveWidget(inputOutputVariablesPanel);
|
||||
inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
||||
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.custom.ColonSpaceValidator;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
|
||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||
|
||||
|
@ -73,9 +74,11 @@ public class ProjectInfoPanel extends ContentPanel {
|
|||
algorithmDescription = new TextField();
|
||||
algorithmDescription.setAllowBlank(false);
|
||||
algorithmDescription.setEmptyText("Enter description...");
|
||||
algorithmDescription.addValidator(new ColonSpaceValidator());
|
||||
algorithmDescription.addValidator(new RegExValidator("^[^\"]*$", "Attention character \" is not allowed"));
|
||||
algorithmDescription.addValidator(new RegExValidator("^[^|]*$", "Attention character | is not allowed"));
|
||||
|
||||
algorithmDescription.addValidator(new RegExValidator("^[a-zA-Z0-9_\\-\\s\\t\\.,;:\\(\\)\\[\\]\\{\\}/~]*$", "Attention the special characters are not allowed"));
|
||||
|
||||
FieldLabel descriptionLabel = new FieldLabel(algorithmDescription, "Description");
|
||||
descriptionLabel.setLabelWidth(LABAEL_WIDTH);
|
||||
|
||||
|
|
Loading…
Reference in New Issue