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) {
|
public void setMainCode(Project project) {
|
||||||
try {
|
try {
|
||||||
globalVariablesPanel.update(project);
|
|
||||||
inputOutputVariablesPanel.update(project);
|
|
||||||
projectInfoPanel.update(project);
|
projectInfoPanel.update(project);
|
||||||
|
inputOutputVariablesPanel.update(project);
|
||||||
interpreterInfoPanel.update(project);
|
interpreterInfoPanel.update(project);
|
||||||
|
globalVariablesPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||||
|
@ -91,10 +91,10 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
public void setBinaryCode(Project project) {
|
public void setBinaryCode(Project project) {
|
||||||
try {
|
try {
|
||||||
globalVariablesPanel.update(project);
|
|
||||||
inputOutputVariablesPanel.update(project);
|
|
||||||
projectInfoPanel.update(project);
|
projectInfoPanel.update(project);
|
||||||
|
inputOutputVariablesPanel.update(project);
|
||||||
interpreterInfoPanel.update(project);
|
interpreterInfoPanel.update(project);
|
||||||
|
globalVariablesPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||||
|
@ -105,10 +105,10 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
public void updateTabs(Project project) {
|
public void updateTabs(Project project) {
|
||||||
try {
|
try {
|
||||||
globalVariablesPanel.update(project);
|
projectInfoPanel.update(project);
|
||||||
inputOutputVariablesPanel.update(project);
|
inputOutputVariablesPanel.update(project);
|
||||||
interpreterInfoPanel.update(project);
|
interpreterInfoPanel.update(project);
|
||||||
projectInfoPanel.update(project);
|
globalVariablesPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
Log.error("Error in InputVariableTabPanel: " + e.getLocalizedMessage());
|
||||||
|
@ -120,8 +120,12 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
InputData inputData = new InputData();
|
InputData inputData = new InputData();
|
||||||
|
|
||||||
if (globalVariablesPanel != null) {
|
InputReadyEvent inputReadyEvent;
|
||||||
inputData.setListGlobalVariables(globalVariablesPanel.getGlobalVariables());
|
|
||||||
|
try {
|
||||||
|
if (projectInfoPanel != null) {
|
||||||
|
ProjectInfo projectInfo = projectInfoPanel.getProjectInfo();
|
||||||
|
inputData.setProjectInfo(projectInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputOutputVariablesPanel != null) {
|
if (inputOutputVariablesPanel != null) {
|
||||||
|
@ -132,17 +136,14 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
inputData.setInterpreterInfo(interpreterInfoPanel.getInterpreterInfo());
|
inputData.setInterpreterInfo(interpreterInfoPanel.getInterpreterInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
InputReadyEvent inputReadyEvent;
|
if (globalVariablesPanel != null) {
|
||||||
try {
|
inputData.setListGlobalVariables(globalVariablesPanel.getGlobalVariables());
|
||||||
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());
|
inputReadyEvent = new InputReadyEvent(inputData);
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.error("Attention invalid info: " + e.getLocalizedMessage());
|
||||||
inputReadyEvent = new InputReadyEvent(inputData, e.getLocalizedMessage());
|
inputReadyEvent = new InputReadyEvent(inputData, e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +153,15 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add
|
// 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) {
|
private void addInputOutputVariablesPanel(Project project) {
|
||||||
TabItemConfig inputOutputPanelItemConf = new TabItemConfig(msgs.inputOutputVariables(), false);
|
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) {
|
public void addSelectedRowsVariable(InputOutputVariables inputOutputVariable) {
|
||||||
setActiveWidget(inputOutputVariablesPanel);
|
setActiveWidget(inputOutputVariablesPanel);
|
||||||
inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
|
inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
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.input.ProjectInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
|
@ -73,8 +74,10 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
algorithmDescription = new TextField();
|
algorithmDescription = new TextField();
|
||||||
algorithmDescription.setAllowBlank(false);
|
algorithmDescription.setAllowBlank(false);
|
||||||
algorithmDescription.setEmptyText("Enter description...");
|
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("^[^|]*$", "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");
|
FieldLabel descriptionLabel = new FieldLabel(algorithmDescription, "Description");
|
||||||
descriptionLabel.setLabelWidth(LABAEL_WIDTH);
|
descriptionLabel.setLabelWidth(LABAEL_WIDTH);
|
||||||
|
|
Loading…
Reference in New Issue